Преглед изворни кода

mdns: add bound check when setting interface as duplicate

Closes IDF-2787

Partially addresses https://github.com/espressif/esp-idf/issues/6440
suren.gabrielyan пре 5 година
родитељ
комит
2b9d2c06f5
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      components/mdns/mdns.c

+ 3 - 0
components/mdns/mdns.c

@@ -2202,6 +2202,9 @@ static void _mdns_dup_interface(mdns_if_t tcpip_if)
 {
     uint8_t i;
     mdns_if_t other_if = _mdns_get_other_if (tcpip_if);
+    if (other_if == MDNS_IF_MAX) {
+        return; // no other interface found
+    }
     for (i=0; i<MDNS_IP_PROTOCOL_MAX; i++) {
         if (_mdns_server->interfaces[other_if].pcbs[i].pcb) {
             //stop this interface and mark as dup