]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Trust inet_pton to validate IPv6 addresses and nothing more. 15570/head
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 19 May 2025 14:24:58 +0000 (16:24 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 19 May 2025 14:24:58 +0000 (16:24 +0200)
Fixes #15569

pdns/pdnsutil.cc
pdns/ws-auth.cc

index 9ec564d4434af5775234a2d2874c60a39819ba3b..9240937b7150b5a4a9285cc1970d2b21ec72fb16 100644 (file)
@@ -479,7 +479,7 @@ static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const ZoneName& zone, co
         }
       } else {
         struct in6_addr tmpbuf;
-        if (inet_pton(AF_INET6, rr.content.c_str(), &tmpbuf) != 1 || rr.content.find('.') != string::npos) {
+        if (inet_pton(AF_INET6, rr.content.c_str(), &tmpbuf) != 1) {
           cout<<"[Warning] Following record is not a valid IPv6 address: "<<rr.qname<<" IN " <<rr.qtype.toString()<< " '" << rr.content<<"'"<<endl;
           numwarnings++;
         }
index 295cecbb7fdbc4a39a69230c654dcffd0554920c..79fc84ca1286bdfdeb1b02ae70718a6d91226823 100644 (file)
@@ -612,7 +612,7 @@ static void gatherRecords(const Json& container, const DNSName& qname, const QTy
       }
       else {
         struct in6_addr tmpbuf{};
-        if (inet_pton(AF_INET6, content.c_str(), &tmpbuf) != 1 || content.find('.') != string::npos) {
+        if (inet_pton(AF_INET6, content.c_str(), &tmpbuf) != 1) {
           throw std::runtime_error("Invalid IPv6 address");
         }
       }