From: Remi Gacogne Date: Mon, 24 Oct 2016 09:09:00 +0000 (+0200) Subject: auth: Correctly check unknown record content size X-Git-Tag: rec-4.1.0-alpha1~339^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4889%2Fhead;p=thirdparty%2Fpdns.git auth: Correctly check unknown record content size --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index ebdcf0a067..25f6851005 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -44,8 +44,8 @@ public: throw MOADNSException("Unknown record was stored incorrectly, need 3 fields, got "+std::to_string(parts.size())+": "+zone ); const string& relevant=(parts.size() > 2) ? parts[2] : ""; unsigned int total=pdns_stou(parts[1]); - if(relevant.size()!=2*total) - throw MOADNSException((boost::format("invalid unknown record length for label %s: size not equal to length field (%d != %d)") % d_dr.d_name.toString() % relevant.size() % (2*total)).str()); + if(relevant.size() % 2 || relevant.size() / 2 != total) + throw MOADNSException((boost::format("invalid unknown record length: size not equal to length field (%d != 2 * %d)") % relevant.size() % total).str()); string out; out.reserve(total+1); for(unsigned int n=0; n < total; ++n) {