From: Tobias Brunner Date: Tue, 28 Jan 2020 10:06:59 +0000 (+0100) Subject: array: Avoid overflow in size calculation X-Git-Tag: 5.8.3dr1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bcbf20b3d3f851a541cf3381bac1ddef04f1488;p=thirdparty%2Fstrongswan.git array: Avoid overflow in size calculation While it's unlikely that so many (large) items are allocated, this is technically more correct. The result previously could overflow an unsigned int (the conversion to size_t happened afterwards). --- diff --git a/src/libstrongswan/collections/array.c b/src/libstrongswan/collections/array.c index fea28cedbf..93c35bc121 100644 --- a/src/libstrongswan/collections/array.c +++ b/src/libstrongswan/collections/array.c @@ -68,7 +68,7 @@ static size_t get_size(array_t *array, uint32_t num) { if (array->esize) { - return array->esize * num; + return (size_t)array->esize * num; } return sizeof(void*) * num; }