]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 18 Oct 2023 08:27:30 +0000 (08:27 +0000)
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 3eed2366abd4ffe8f0fd818a9fdd1aea9d0bad30..ef77d4f766b6529e30e56a9f922ea4958f1a5d9e 100644 (file)
@@ -175,6 +175,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? */
 }
 
@@ -828,6 +832,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