mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-19 12:38:19 +00:00
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
1 changed files with 3 additions and 2 deletions
|
|
@ -260,8 +260,9 @@ static void wgetjson_json_item_scan(cJSON *item, const char *prefix)
|
|||
|
||||
while (item)
|
||||
{
|
||||
newprefix = malloc(strlen(prefix) + strlen(item->string) + 2);
|
||||
sprintf(newprefix, "%s/%s", prefix, item->string);
|
||||
const char *string = item->string ? item->string : "(null)";
|
||||
newprefix = malloc(strlen(prefix) + strlen(string) + 2);
|
||||
sprintf(newprefix, "%s/%s", prefix, string);
|
||||
|
||||
dorecurse = wgetjson_json_item_callback(newprefix, item->type, item);
|
||||
if (item->child && dorecurse)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue