]> granicus.if.org Git - pdns/commitdiff
Throw on negative label length in `DNSName::isPartOf()`
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 28 Apr 2016 08:59:27 +0000 (10:59 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 28 Apr 2016 08:59:27 +0000 (10:59 +0200)
Found with American Fuzzy Lop and Address Sanitizer.

pdns/dnsname.cc

index 7111ff18d123159033bc6f08ce70a270a52d22f2..cfc4d4bebe0507b7de44e16335f7f84f7d824781 100644 (file)
@@ -201,6 +201,9 @@ bool DNSName::isPartOf(const DNSName& parent) const
       }
       return true;
     }
+    if (*us < 0) {
+      throw std::out_of_range("negative label length in dnsname");
+    }
   }
   return false;
 }