From cf52603086df876ba883d6e5031eb94565a9cc61 Mon Sep 17 00:00:00 2001 From: lxyjy6 <1229662551@qq.com> Date: Thu, 23 Oct 2025 02:26:58 +0800 Subject: [PATCH] add null pointer check in cJSON_ReplaceItemInObjectCaseSensitive --- cJSON.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cJSON.c b/cJSON.c index 6e4fb0dd..904b11e4 100644 --- a/cJSON.c +++ b/cJSON.c @@ -2439,6 +2439,9 @@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *st CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) { + if (newitem == NULL) { + return false; + } return replace_item_in_object(object, string, newitem, true); }