From bb8b91e1b0ba3ecc44c629da8d45368f8ff6fc32 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Wed, 20 May 2026 18:43:58 +0200 Subject: [PATCH] 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 --- daemon/control_ng.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon/control_ng.c b/daemon/control_ng.c index e77890867..b2516557a 100644 --- a/daemon/control_ng.c +++ b/daemon/control_ng.c @@ -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; }