]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
SuffixMatchTree: Fix the removal of the root
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 7 Jun 2019 10:23:48 +0000 (12:23 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 7 Jun 2019 10:24:12 +0000 (12:24 +0200)
pdns/dnsname.hh

index e5f6b11dbbaa639f51910068aa47ee3dca260c84..be58ea3c4e904c28f8daab0e999b6538ffc2e69b 100644 (file)
@@ -299,6 +299,11 @@ struct SuffixMatchTree
    */
   void remove(std::vector<std::string> 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()) {