From f9fcedd3b9df5260939c4d633ea5d99f6a30d3d9 Mon Sep 17 00:00:00 2001 From: youbing54 Date: Sat, 31 Aug 2024 16:36:40 +0800 Subject: [PATCH] IssueNo: https://gitee.com/openharmony/third_party_cJSON/issues/IANUKP describe: check for NULL in cJSON_DetachItemViaPointer Feature or Bugfix: Bugfix Binary Source:Yes Signed-off-by: youbing54 --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index e8437b3..63fb043 100644 --- a/cJSON.c +++ b/cJSON.c @@ -2448,7 +2448,7 @@ CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * c CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) { - if ((parent == NULL) || (item == NULL)) + if ((parent == NULL) || (item == NULL) || (item != parent->child && item->prev == NULL)) { return NULL; } -- Gitee