From 116363e5c639be5e35483ad72ac275e5cfaee4eb Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 24 Jul 2013 16:03:38 +0200 Subject: [PATCH] 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. --- src/libstrongswan/collections/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstrongswan/collections/array.c b/src/libstrongswan/collections/array.c index d92eaac..387e2a5 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) { -- 2.7.4