mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-29 19:46:19 +08:00
mdns: Fix copying of invalid search result domains
Fixes bugs #68314 and #68365
This commit is contained in:
@@ -1905,9 +1905,13 @@ mdns_handle_response(struct mdns_packet *pkt, struct netif *netif)
|
||||
u16_t off = (ans.info.type == DNS_RRTYPE_SRV ? 6 : 0);
|
||||
u16_t len = mdns_readname(pkt->pbuf, ans.rd_offset + off, &data.dom);
|
||||
if (len == MDNS_READNAME_ERROR) {
|
||||
u16_t copy_len = LWIP_MIN(MDNS_DOMAIN_MAXLEN, ans.rd_length - off);
|
||||
if (ans.rd_length < off) {
|
||||
/* Skip packet - SRV rd data shorter than fixed header. */
|
||||
break;
|
||||
}
|
||||
/* Ensure result_fn is called anyway, just copy failed domain as is */
|
||||
data.dom.length = ans.rd_length - off;
|
||||
memcpy(&data.dom, (const char *)p->payload + offset + off, data.dom.length);
|
||||
data.dom.length = pbuf_copy_partial(p, data.dom.name, copy_len, offset + off);
|
||||
}
|
||||
/* Adjust len/off according RR type */
|
||||
if (ans.info.type == DNS_RRTYPE_SRV) {
|
||||
|
||||
Reference in New Issue
Block a user