From 6f2176b478bc50148b3ba245dffdfed8b06b47b8 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 20 Apr 2026 11:09:49 +0200 Subject: [PATCH] rec: Use `DNSName::trimToLabels` as suggested by Miod (thanks!) Signed-off-by: Remi Gacogne --- pdns/validate.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pdns/validate.cc b/pdns/validate.cc index 6af443acc1..aec3b425d9 100644 --- a/pdns/validate.cc +++ b/pdns/validate.cc @@ -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; -- 2.47.3