]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3817: Memory leak in SSL cert validate for alt_name peer certs
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 17 Apr 2013 08:14:56 +0000 (11:14 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 17 Apr 2013 08:14:56 +0000 (11:14 +0300)
Inside function Ssl::matchX509CommonNames which checks a domain name against
certificate common name and alternate names, if the domain matches any of the
alternate names the function return without releasing allocated data.

src/ssl/support.cc

index c738c2fb425be618e2587672739025841d73510f..c701bd6bda2b02b5f3da53db3d5c501096cbbbed 100644 (file)
@@ -191,8 +191,10 @@ int Ssl::matchX509CommonNames(X509 *peer_cert, void *check_data, int (*check_fun
             }
             ASN1_STRING *cn_data = check->d.dNSName;
 
-            if ( (*check_func)(check_data, cn_data) == 0)
+            if ( (*check_func)(check_data, cn_data) == 0) {
+                sk_GENERAL_NAME_pop_free(altnames, GENERAL_NAME_free);
                 return 1;
+            }
         }
         sk_GENERAL_NAME_pop_free(altnames, GENERAL_NAME_free);
     }