Selaa lähdekoodia

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

Meco Man 3 vuotta sitten
vanhempi
sitoutus
b235c3db72
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  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);
         cJSON_free(replacement->string);
     }
     }
     replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
     replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
+    if (replacement->string == NULL)
+    {
+        return false;
+    }
+
     replacement->type &= ~cJSON_StringIsConst;
     replacement->type &= ~cJSON_StringIsConst;
 
 
     return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);
     return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);