array: Number of items in get_size() is unsigned

Otherwise, array->esize is promoted to int and if array->esize * num
results in a value > 0x7fffffff the return value would be incorrect due
the implicit sign extension when getting cast to size_t.
This commit is contained in:
Tobias Brunner
2013-07-25 11:28:01 +02:00
parent d7dc4fedd1
commit 116363e5c6
+1 -1
View File
@@ -49,7 +49,7 @@ struct array_t {
/**
* Get the actual size of a number of elements
*/
static size_t get_size(array_t *array, int num)
static size_t get_size(array_t *array, u_int32_t num)
{
if (array->esize)
{