From f82f0f6e6ca31d7a1f2a35a10ea3f40fe53cfb8e Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 25 Oct 2016 17:40:09 +0200 Subject: [PATCH] auth: Correctly check unknown record content size --- pdns/dnsparser.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) { -- 2.47.2