mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix caching bug with negative records.
To provoke this bug, at least the following must be true. A reply must be a CNAME. The target of the CNAME must not exist for the queried RR (a No Data reply). The No Data reply must include an SOA record in the NS section. The query must take place over TCP. The result is the caching of a CNAME whose target is the name of the SOA record, instead of the No data record. If there is a RR at this target, then a subsequent query for that RRtype will get a qrong reply. Thanks to the testers extraordinaire at Pi-Hole for spotting this and providing enough information to chase it down.
This commit is contained in:
@@ -938,15 +938,14 @@ int cache_recv_insert(time_t now, int fd)
|
||||
if (newc)
|
||||
{
|
||||
newc->addr.cname.is_name_ptr = 0;
|
||||
newc->addr.cname.target.cache = crecp;
|
||||
|
||||
if (!crecp)
|
||||
newc->addr.cname.target.cache = NULL;
|
||||
else
|
||||
if (crecp)
|
||||
{
|
||||
next_uid(crecp);
|
||||
newc->addr.cname.target.cache = crecp;
|
||||
newc->addr.cname.uid = crecp->uid;
|
||||
}
|
||||
crecp = newc;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user