ensure: Fix overflow detection

This commit is contained in:
Max Bruckner 2017-04-05 16:35:55 +02:00
parent 3c1bfe125c
commit 2683d4d987

View File

@ -276,7 +276,7 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna
}
/* calculate new buffer size */
if (newsize > (INT_MAX / 2))
if (needed > (INT_MAX / 2))
{
/* overflow of int, use INT_MAX if possible */
if (needed <= INT_MAX)