wgetjson_json_item_scan: fix a NULL dereference
I'm not sure if this is the correct fix. wgetjson_json_item_callback seems to expect it to be formatted as "(null)".
This commit is contained in:
parent
b5d7004a8d
commit
b05a1f61e2
@ -260,8 +260,9 @@ static void wgetjson_json_item_scan(cJSON *item, const char *prefix)
|
|||||||
|
|
||||||
while (item)
|
while (item)
|
||||||
{
|
{
|
||||||
newprefix = malloc(strlen(prefix) + strlen(item->string) + 2);
|
const char *string = item->string ? item->string : "(null)";
|
||||||
sprintf(newprefix, "%s/%s", prefix, item->string);
|
newprefix = malloc(strlen(prefix) + strlen(string) + 2);
|
||||||
|
sprintf(newprefix, "%s/%s", prefix, string);
|
||||||
|
|
||||||
dorecurse = wgetjson_json_item_callback(newprefix, item->type, item);
|
dorecurse = wgetjson_json_item_callback(newprefix, item->type, item);
|
||||||
if (item->child && dorecurse)
|
if (item->child && dorecurse)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user