From: Tobias Brunner Date: Wed, 24 Jul 2013 14:03:38 +0000 (+0200) Subject: array: Number of items in get_size() is unsigned X-Git-Tag: 5.1.0~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=116363e5c639be5e35483ad72ac275e5cfaee4eb;p=thirdparty%2Fstrongswan.git 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. --- diff --git a/src/libstrongswan/collections/array.c b/src/libstrongswan/collections/array.c index d92eaacfe4..387e2a57de 100644 --- a/src/libstrongswan/collections/array.c +++ b/src/libstrongswan/collections/array.c @@ -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) {