From c9742dfbf4040931ff84e34b12db5d0e4e5499e0 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 28 Apr 2016 10:59:27 +0200 Subject: [PATCH] Throw on negative label length in `DNSName::isPartOf()` Found with American Fuzzy Lop and Address Sanitizer. --- pdns/dnsname.cc | 3 +++ 1 file changed, 3 insertions(+) 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; } -- 2.47.2