]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Use `DNSName::trimToLabels` as suggested by Miod (thanks!) 17156/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Apr 2026 09:09:49 +0000 (11:09 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Apr 2026 09:09:49 +0000 (11:09 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/validate.cc

index 6af443acc1d6d62029470eed20544c213cf61dfd..aec3b425d97cae907af389e968a7c00b1ac00de1 100644 (file)
@@ -581,10 +581,7 @@ dState getDenial(const cspmap_t& validrrsets, const DNSName& qname, const uint16
              and can prevent the wildcard from applying.
           */
           nameToDeny = qname;
-          const auto chopCount = nameToDeny.countLabels() - wildcardLabelsCount - 1;
-          for (size_t idx = 0; idx < chopCount; ++idx) {
-            nameToDeny.chopOff();
-          }
+          nameToDeny.trimToLabels(wildcardLabelsCount + 1);
         }
         else {
           nameToDeny = qname;