]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Replace the use of strncasecmp with pdns_ilexicographical_compare_three_way.
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 13 Jul 2026 08:45:06 +0000 (10:45 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 13 Jul 2026 08:45:06 +0000 (10:45 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/dnsparser.cc

index da0ea5568265dd38fe2f35f05524b610cb7fdde4..05c044dc76da0498867b1c179fb0c8b227558d83 100644 (file)
@@ -786,7 +786,8 @@ string simpleCompress(const string& elabel, const string& root)
   string ret;
   ret.reserve(label.size()+4);
   for(const auto & part : parts) {
-    if(!root.empty() && !strncasecmp(root.c_str(), label.c_str() + part.first, 1 + label.length() - part.first)) { // also match trailing 0, hence '1 +'
+    auto label_part = std::string_view(label.c_str() + part.first, 1 + label.length() - part.first); // also match trailing 0, hence '1 +'
+    if(!root.empty() && pdns_ilexicographical_compare_three_way(root, label_part) == 0) {
       const unsigned char rootptr[2]={0xc0,0x11};
       ret.append((const char *) rootptr, 2);
       return ret;