MT#61856 control_ng: `json_list_iter()` handle `item_callback`

If any caller passes NULL for item callback and
then receives a JSON with a nested object/list/int, this can crash.

Change-Id: I69fbb9fec76305f6e1ed9ea5b25a50a7ee85c454
mr26.1
Donat Zenichev 4 weeks ago
parent ab534f3412
commit bb8b91e1b0

@ -365,7 +365,10 @@ static const char *json_list_iter(const ng_parser_t *parser, JsonNode *list,
err = str_callback(STR_PTR(s), i, arg);
}
else
err = item_callback(parser, n, arg);
if (item_callback)
err = item_callback(parser, n, arg);
else
ilog(LOG_DEBUG, "Ignoring non-string value in list");
if (err)
return err;
}

Loading…
Cancel
Save