mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix CVE-2017-13704, which resulted in a crash on a large DNS query.
A DNS query recieved by UDP which exceeds 512 bytes (or the EDNS0 packet size, if different.) is enough to cause SIGSEGV.
This commit is contained in:
@@ -1188,6 +1188,10 @@ void receive_query(struct listener *listen, time_t now)
|
||||
(msg.msg_flags & MSG_TRUNC) ||
|
||||
(header->hb3 & HB3_QR))
|
||||
return;
|
||||
|
||||
/* Clear buffer beyond request to avoid risk of
|
||||
information disclosure. */
|
||||
memset(daemon->packet + n, 0, daemon->edns_pktsz - n);
|
||||
|
||||
source_addr.sa.sa_family = listen->family;
|
||||
|
||||
@@ -1688,6 +1692,10 @@ unsigned char *tcp_request(int confd, time_t now,
|
||||
|
||||
if (size < (int)sizeof(struct dns_header))
|
||||
continue;
|
||||
|
||||
/* Clear buffer beyond request to avoid risk of
|
||||
information disclosure. */
|
||||
memset(payload + size, 0, 65536 - size);
|
||||
|
||||
query_count++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user