From 46f76956daace67af1120627a345f5abe0a360b9 Mon Sep 17 00:00:00 2001 From: youbing54 Date: Wed, 2 Apr 2025 10:20:58 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:=20https://gitee.com/openharmony/third?= =?UTF-8?q?=5Fparty=5FcJSON/issues/IBPPMD=20describe:=20CVE-2024-31755?= =?UTF-8?q?=E6=BC=8F=E6=B4=9E=E4=BF=AE=E5=A4=8D=E6=8C=91=E5=8D=954.1releas?= =?UTF-8?q?e=20Feature=20or=20Bugfix:=20Bugfix=20Binary=20Source:Yes=20Sig?= =?UTF-8?q?ned-off-by:=20youbing54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cJSON.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 3a7219a..3c90a7e 100644 --- a/cJSON.c +++ b/cJSON.c @@ -406,10 +406,11 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring) return NULL; } /* return NULL if the object is corrupted */ - if (object->valuestring == NULL) + if (object->valuestring == NULL || valuestring == NULL) { return NULL; } + if (strlen(valuestring) <= strlen(object->valuestring)) { strcpy(object->valuestring, valuestring); -- Gitee