From: Remi Gacogne Date: Tue, 25 Oct 2016 15:40:09 +0000 (+0200) Subject: auth: Correctly check unknown record content size X-Git-Tag: auth-3.4.11~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4890%2Fhead;p=thirdparty%2Fpdns.git auth: Correctly check unknown record content size --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index 7276101509..12e4f45691 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -63,8 +63,8 @@ public: throw MOADNSException("Unknown record was stored incorrectly, need 3 fields, got "+lexical_cast(parts.size())+": "+tmp ); const string& relevant=(parts.size() > 2) ? parts[2] : ""; unsigned int total=atoi(parts[1].c_str()); - 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_label.c_str() % relevant.size() % (2*total)).str()); + if(relevant.size() % 2 || relevant.size() / 2 != total) + throw MOADNSException((boost::format("invalid unknown record length for label %s: size not equal to length field (%d != 2 * %d)") % d_dr.d_label.c_str() % relevant.size() % total).str()); string out; out.reserve(total+1); for(unsigned int n=0; n < total; ++n) {