瀏覽代碼

handle null pointers: cJSON_CreateStringArray

Max Bruckner 8 年之前
父節點
當前提交
9585c38d5a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      cJSON.c

+ 1 - 1
cJSON.c

@@ -2278,7 +2278,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count)
     cJSON *p = NULL;
     cJSON *a = NULL;
 
-    if (count < 0)
+    if ((count < 0) || (strings == NULL))
     {
         return NULL;
     }