Closed
Description
First, the function:
cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item)
{
cJSON_AddItemToObjectCS(object, (char*)cJSON_strdup((const unsigned char*)string, &global_hooks), item)
item->type &= ~cJSON_StringIsConst;
}
In cJSON_AddItemToObjectCS we see:
if (!item)
{
return;
}
So that would be fine, but then, cJSON_AddItemToObject references a field from item, which, as we know, is a NULL.
Activity
FSMaxB commentedon Jun 27, 2017
Yes,
cJSON_AddItemToObject
should also check if the item is aNULL
pointer.FSMaxB commentedon Jun 28, 2017
Fixed in version 1.5.6