mirror of
https://github.com/espressif/esp-idf
synced 2025-03-12 10:39:11 -04:00
mdns: Fix issue with some mDNS parsers
Some mDNS parser have issue with zero terminated TXT lists. This fix targets to overcome this issue. Found and tested with jmdns.
This commit is contained in:
parent
8baa6b9d8b
commit
d6c06ed0b5
@ -803,7 +803,7 @@ static uint16_t _mdns_append_txt_record(uint8_t * packet, uint16_t * index, mdns
|
|||||||
record_length += part_length;
|
record_length += part_length;
|
||||||
|
|
||||||
uint16_t data_len_location = *index - 2;
|
uint16_t data_len_location = *index - 2;
|
||||||
uint16_t data_len = 1;
|
uint16_t data_len = 0;
|
||||||
|
|
||||||
char * tmp;
|
char * tmp;
|
||||||
mdns_txt_linked_item_t * txt = service->txt;
|
mdns_txt_linked_item_t * txt = service->txt;
|
||||||
@ -820,9 +820,11 @@ static uint16_t _mdns_append_txt_record(uint8_t * packet, uint16_t * index, mdns
|
|||||||
}
|
}
|
||||||
txt = txt->next;
|
txt = txt->next;
|
||||||
}
|
}
|
||||||
|
if (!data_len) {
|
||||||
packet[*index] = 0;
|
data_len = 1;
|
||||||
*index = *index + 1;
|
packet[*index] = 0;
|
||||||
|
*index = *index + 1;
|
||||||
|
}
|
||||||
_mdns_set_u16(packet, data_len_location, data_len);
|
_mdns_set_u16(packet, data_len_location, data_len);
|
||||||
record_length += data_len;
|
record_length += data_len;
|
||||||
return record_length;
|
return record_length;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user