From dbeebfee558896219c1a44974a66548190b7d4ee Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 7 Jun 2019 12:23:48 +0200 Subject: [PATCH] SuffixMatchTree: Fix the removal of the root --- pdns/dnsname.hh | 5 +++++ 1 file changed, 5 insertions(+) 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()) { -- 2.47.2