From: Remi Gacogne Date: Tue, 12 Dec 2017 13:56:03 +0000 (+0100) Subject: rec: Pass the correct buffer size to arecvfrom() X-Git-Tag: dnsdist-1.3.0~178^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4185f0895fbda41e8ffa21f39721db1f018a3466;p=pdns rec: Pass the correct buffer size to arecvfrom() The size we used to pass to arecvfrom() along with our buffer was off by one byte, resulting in the last byte of our buffer to be uninitialized for answers exactly matching our outgoing buffer size. Since we passed the correct size to MOADNSParser, we were reading one bye of unitialized memory for such answers. This caused issue with some authoritative servers sending an answer of our exact buffer size, causing a parsing error. We would then retry without EDNS, causing DNSSEC validation failures for some domains on such authoritative servers. --- diff --git a/pdns/lwres.cc b/pdns/lwres.cc index 516f92d99..6c045a8b9 100644 --- a/pdns/lwres.cc +++ b/pdns/lwres.cc @@ -161,7 +161,7 @@ int asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool d // sleep until we see an answer to this, interface to mtasker - ret=arecvfrom(reinterpret_cast(buf.get()), bufsize-1,0, ip, &len, qid, + ret=arecvfrom(reinterpret_cast(buf.get()), bufsize, 0, ip, &len, qid, domain, type, queryfd, now); } else {