Permalink
Browse files

import CVE-2015-1868 patch

  • Loading branch information...
1 parent 757c29c commit 9df4944d8d5d24ae722006509229314902090798 @Habbie Habbie committed May 1, 2015
Showing with 3 additions and 2 deletions.
  1. +3 −2 pdns/dnsparser.cc
View
@@ -433,9 +433,10 @@ string PacketReader::getText(bool multi)
void PacketReader::getLabelFromContent(const vector<uint8_t>& content, uint16_t& frompos, string& ret, int recurs)
{
- if(recurs > 1000) // the forward reference-check below should make this test 100% obsolete
+ if(recurs > 100) // the forward reference-check below should make this test 100% obsolete
throw MOADNSException("Loop");
+ int pos = frompos;
for(;;) {
unsigned char labellen=content.at(frompos++);
@@ -448,7 +449,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)
throw MOADNSException("forward reference during label decompression");
return getLabelFromContent(content, offset, ret, ++recurs);
}

0 comments on commit 9df4944

Please sign in to comment.