From 2683d4d9873df87c4bdccc523903ddd78d1ad250 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 5 Apr 2017 16:35:55 +0200 Subject: [PATCH] ensure: Fix overflow detection --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 1b3c4e2..0c689c8 100644 --- a/cJSON.c +++ b/cJSON.c @@ -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)