From: Remi Gacogne Date: Thu, 28 Apr 2016 08:59:27 +0000 (+0200) Subject: Throw on negative label length in `DNSName::isPartOf()` X-Git-Tag: rec-4.0.0-alpha3~30^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9742dfbf4040931ff84e34b12db5d0e4e5499e0;p=thirdparty%2Fpdns.git Throw on negative label length in `DNSName::isPartOf()` Found with American Fuzzy Lop and Address Sanitizer. --- diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 7111ff18d1..cfc4d4bebe 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -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; }