Explorar el Código

ensure: Fix overflow detection

Max Bruckner hace 8 años
padre
commit
2683d4d987
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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)