Explorar o código

handle null pointers: cJSON_CreateIntArray

Max Bruckner %!s(int64=8) %!d(string=hai) anos
pai
achega
010e31f2f2
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      cJSON.c

+ 1 - 1
cJSON.c

@@ -2171,7 +2171,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count)
     cJSON *p = NULL;
     cJSON *a = NULL;
 
-    if (count < 0)
+    if ((count < 0) || (numbers == NULL))
     {
         return NULL;
     }