Overflow detection in u3a_calloc

This implementation assumes that u3a_calloc is always called with
safe sizes and just asserts that.
This commit is contained in:
Steven Dee 2015-03-27 12:14:23 -04:00
parent 41a9316b75
commit b5343f227b

5
n/a.c
View File

@ -522,7 +522,10 @@ void*
u3a_calloc(size_t num_i, size_t len_i)
{
size_t byt_i = num_i * len_i;
c3_w* out_w = u3a_malloc(byt_i);
c3_w* out_w;
c3_assert(byt_i / len_i == num_i);
out_w = u3a_malloc(byt_i);
memset(out_w, 0, byt_i);
return out_w;