Permalink
Browse files

fix forward reference-check in getLabelFromContent()

  • Loading branch information...
1 parent 2180e21 commit 55f2dbfc6f1d26657efa2c70a75e7862f39d64e8 @mind04 mind04 committed with mind04 Apr 13, 2015
Showing with 2 additions and 1 deletion.
  1. +2 −1 pdns/dnsparser.cc
View
@@ -458,6 +458,7 @@ void PacketReader::getLabelFromContent(const vector<uint8_t>& content, uint16_t&
if(recurs > 1000) // the forward reference-check below should make this test 100% obsolete
throw MOADNSException("Loop");
+ int pos = frompos;
for(;;) {
unsigned char labellen=content.at(frompos++);
@@ -470,7 +471,7 @@ void PacketReader::getLabelFromContent(const vector<uint8_t>& content, uint16_t&
uint16_t offset=256*(labellen & ~0xc0) + (unsigned int)content.at(frompos++) - sizeof(dnsheader);
// cout<<"This is an offset, need to go to: "<<offset<<endl;
- if(offset >= frompos-2)
+ if(offset >= pos-2)
throw MOADNSException("forward reference during label decompression");
return getLabelFromContent(content, offset, ret, ++recurs);
}

0 comments on commit 55f2dbf

Please sign in to comment.