From: bert hubert Date: Fri, 29 Aug 2014 14:28:11 +0000 (+0200) Subject: improve error reporting on malformed labels X-Git-Tag: auth-3.4.0-rc2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ffd51d5b94270f2bdd74a48cd7ba5d59915a5f6;p=thirdparty%2Fpdns.git improve error reporting on malformed labels --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index a03644e8b0..595a4afbdf 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -466,7 +466,7 @@ void PacketReader::getLabelFromContent(const vector& content, uint16_t& ret.append(1,'.'); break; } - if((labellen & 0xc0) == 0xc0) { + else if((labellen & 0xc0) == 0xc0) { uint16_t offset=256*(labellen & ~0xc0) + (unsigned int)content.at(frompos++) - sizeof(dnsheader); // cout<<"This is an offset, need to go to: "<& content, uint16_t& throw MOADNSException("forward reference during label decompression"); return getLabelFromContent(content, offset, ret, ++recurs); } + else if(labellen > 63) + throw MOADNSException("Overly long label during label decompression ("+lexical_cast((unsigned int)labellen)+")"); else { // XXX FIXME THIS MIGHT BE VERY SLOW! ret.reserve(ret.size() + labellen + 2); diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index efd61762e7..c4660fc188 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -894,7 +894,6 @@ string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fr return 0; } - if(MT->numProcesses() > g_maxMThreads) { g_stats.overCapacityDrops++; return 0;