From: bert hubert Date: Mon, 8 Oct 2018 15:01:20 +0000 (+0200) Subject: robustify and comment detection of /0 answers X-Git-Tag: rec-4.2.0-alpha1~42^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40669042ac11bff0fceb1a37c2e1fadcb6adc9bb;p=thirdparty%2Fpdns.git robustify and comment detection of /0 answers --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 21e76401ae..ce48a2c58f 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -301,8 +301,10 @@ bool fixUpResponse(char** response, uint16_t* responseLen, size_t* responseSize, int res = locateEDNSOptRR(responseStr, &optStart, &optLen, &last); if (res == 0) { - if(zeroScope) - *zeroScope = optLen > 18 && !responseStr.at(optStart + 18); + if(zeroScope) { // this finds if an EDNS scope was set, and if it is 0 + *zeroScope = optLen > 18 && !responseStr.at(optStart + 18) && !responseStr.at(optStart + 11) && responseStr.at(optStart + 12) ==8; + } + // this test only detects a /0 if ECS is the first option if (ednsAdded) { /* we added the entire OPT RR,