Przeglądaj źródła

ensure: Fix overflow detection

Max Bruckner 8 lat temu
rodzic
commit
2683d4d987
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      cJSON.c

+ 1 - 1
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)