Description: cJSON_SetValuestring入参增加判空防止错误调用导致崩溃
IssueNo:https://gitee.com/openharmony/third_party_cJSON/issues/I9EP9J
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: liubo419 <liubo419@huawei.com>
This commit is contained in:
liubo
2024-04-08 09:54:38 +08:00
committed by 刘波
parent b56793e69e
commit 8d745efb50
+1 -1
View File
@@ -406,7 +406,7 @@ 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;
}