From: Miod Vallat Date: Mon, 13 Jul 2026 09:04:49 +0000 (+0200) Subject: Replace the use of strncasecmp with pdns_ilexicographical_compare_three_way. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e6e7b701ebd83d3e403b47dace8692672b89966;p=thirdparty%2Fpdns.git Replace the use of strncasecmp with pdns_ilexicographical_compare_three_way. Signed-off-by: Miod Vallat --- diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index d541c2f64b..6660650a83 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -364,9 +364,11 @@ template uint16_t GenericDNSPacketWriter::lookup break; } - if (strncasecmp(raw.c_str() + *positionInNameIter + 1, (const char*)&d_content[*positionInPacketIter] + 1, nlen)) { + auto rawpart = std::string_view(raw.c_str() + *positionInNameIter + 1, nlen); + auto pktpart = std::string_view((const char*)&d_content[*positionInPacketIter] + 1, nlen); + if (pdns_ilexicographical_compare_three_way(rawpart, pktpart) != 0) { if (l_verbose) { - cout << "Mismatch: " << string(raw.c_str() + *positionInNameIter + 1, raw.c_str() + *positionInNameIter + nlen + 1) << " != " << string((const char*)&d_content[*positionInPacketIter] + 1, (const char*)&d_content[*positionInPacketIter] + nlen + 1) << endl; + cout << "Mismatch: " << rawpart << " != " << pktpart << endl; } break; }