From: Nicolas Badoux Date: Fri, 23 Aug 2024 14:14:10 +0000 (+0000) Subject: Check for NULL in cJSON_DetachItemViaPointer X-Git-Url: https://git.feebdaed.xyz/?a=commitdiff_plain;h=f28a468e3b287d633fea5d4d5ab444bb9354b4bc;p=0xmirror%2FcJSON.git Check for NULL in cJSON_DetachItemViaPointer --- diff --git a/cJSON.c b/cJSON.c index cac1164..483d0c0 100644 --- a/cJSON.c +++ b/cJSON.c @@ -2204,7 +2204,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) || (parent->child == NULL) || (item == NULL) || (item->prev == NULL)) { return NULL; }