From: Peter van Dijk Date: Mon, 22 Oct 2012 13:06:33 +0000 (+0000) Subject: smarter label decompression X-Git-Tag: auth-3.2-rc1~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c923cc0993bed5b24381999097f02a2e1b56ad5;p=pdns smarter label decompression git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2822 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index a983a3f1c..d03aaea52 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -430,7 +430,7 @@ string PacketReader::getText(bool multi) void PacketReader::getLabelFromContent(const vector& content, uint16_t& frompos, string& ret, int recurs) { - if(recurs > 10) + if(recurs > 1000) // the forward reference-check below should make this test 100% obsolete throw MOADNSException("Loop"); for(;;) { @@ -444,6 +444,9 @@ void PacketReader::getLabelFromContent(const vector& content, uint16_t& 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: "<= frompos-2) + throw MOADNSException("forward reference during label decompression"); return getLabelFromContent(content, offset, ret, ++recurs); } else {