Kaynağa Gözat

同步上游参数检查
https://github.com/DaveGamble/cJSON/commit/b45f48e600671feade0b6bd65d1c69de7899f2be

Meco Man 3 yıl önce
ebeveyn
işleme
b235c3db72
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  1. 5 0
      cJSON.c

+ 5 - 0
cJSON.c

@@ -2361,6 +2361,11 @@ static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSO
         cJSON_free(replacement->string);
     }
     replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
+    if (replacement->string == NULL)
+    {
+        return false;
+    }
+
     replacement->type &= ~cJSON_StringIsConst;
 
     return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);