]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix validation of certificates with CN=* (#1523)
authorAndreas Weigel <andreas.weigel@securepoint.de>
Wed, 18 Oct 2023 04:14:31 +0000 (04:14 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 20 Oct 2023 06:15:35 +0000 (19:15 +1300)
The bug was discovered and detailed by Joshua Rogers at
https://megamansec.github.io/Squid-Security-Audit/
where it was filed as "Buffer UnderRead in SSL CN Parsing".

src/anyp/Uri.cc

index 77b6f0c9207fcb4e4bb47ae1bf62cdb9e0bdc1de..a6a5d5d9ed403fbf1ba408787cd18f7558fd87d4 100644 (file)
@@ -173,6 +173,10 @@ urlInitialize(void)
     assert(0 == matchDomainName("*.foo.com", ".foo.com", mdnHonorWildcards));
     assert(0 != matchDomainName("*.foo.com", "foo.com", mdnHonorWildcards));
 
+    assert(0 != matchDomainName("foo.com", ""));
+    assert(0 != matchDomainName("foo.com", "", mdnHonorWildcards));
+    assert(0 != matchDomainName("foo.com", "", mdnRejectSubsubDomains));
+
     /* more cases? */
 }
 
@@ -756,6 +760,8 @@ matchDomainName(const char *h, const char *d, MatchDomainNameFlags flags)
         return -1;
 
     dl = strlen(d);
+    if (dl == 0)
+        return 1;
 
     /*
      * Start at the ends of the two strings and work towards the