From: Remi Gacogne Date: Fri, 7 Jun 2019 10:23:48 +0000 (+0200) Subject: SuffixMatchTree: Fix the removal of the root X-Git-Tag: dnsdist-1.4.0-rc1~122^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dbeebfee558896219c1a44974a66548190b7d4ee;p=thirdparty%2Fpdns.git SuffixMatchTree: Fix the removal of the root --- diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index e5f6b11dbb..be58ea3c4e 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -299,6 +299,11 @@ struct SuffixMatchTree */ void remove(std::vector labels) const { + if (labels.empty()) { // this allows removal of the root + endNode = false; + return; + } + SuffixMatchTree smt(*labels.rbegin()); auto child = children.find(smt); if (child == children.end()) {