Skip to content

Commit

Permalink
fix(mdns): Fixed potential out-of-bound interface error
Browse files Browse the repository at this point in the history
invalid mdns_if was handled for enabling/announcing pcbs,
but not for the consequent browsing

Closes coverity isssue: 470162 Out-of-bounds access
  • Loading branch information
david-cermak committed Jan 15, 2025
1 parent 8f8516c commit 24f55ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/mdns/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -4479,10 +4479,11 @@ void mdns_preset_if_handle_system_event(void *arg, esp_event_base_t event_base,
case IP_EVENT_GOT_IP6: {
ip_event_got_ip6_t *event = (ip_event_got_ip6_t *) event_data;
mdns_if_t mdns_if = _mdns_get_if_from_esp_netif(event->esp_netif);
if (mdns_if < MDNS_MAX_INTERFACES) {
post_mdns_enable_pcb(mdns_if, MDNS_IP_PROTOCOL_V6);
post_mdns_announce_pcb(mdns_if, MDNS_IP_PROTOCOL_V4);
if (mdns_if >= MDNS_MAX_INTERFACES) {
return;
}
post_mdns_enable_pcb(mdns_if, MDNS_IP_PROTOCOL_V6);
post_mdns_announce_pcb(mdns_if, MDNS_IP_PROTOCOL_V4);
mdns_browse_t *browse = _mdns_server->browse;
while (browse) {
_mdns_browse_send(browse, mdns_if);
Expand Down

0 comments on commit 24f55ce

Please sign in to comment.