From f5be2f4115a9da0e9aaab30bfd439f0043d8dbb4 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 13 Jan 2025 11:37:51 +0100 Subject: [PATCH] fix(mdns): Fix potential null derefernce in _mdns_execute_action() We did check for null-deref before checking 'a->type', but contol continues and passes potential null-ptr to the processing function _mdns_execute_action() Fixed by asserting action != NULL, since it is an invalid state which should never happen. --- components/mdns/mdns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index c1d41de0e..b4d18364c 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -5346,7 +5346,8 @@ static void _mdns_service_task(void *pvParameters) for (;;) { if (_mdns_server && _mdns_server->action_queue) { if (xQueueReceive(_mdns_server->action_queue, &a, portMAX_DELAY) == pdTRUE) { - if (a && a->type == ACTION_TASK_STOP) { + assert(a); + if (a->type == ACTION_TASK_STOP) { break; } MDNS_SERVICE_LOCK();