]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
we only need to call ASN1_STRING_length() if ASN1_STRING_type() detects UTF-8,
authorGunter Knauf <gk@gknw.de>
Wed, 14 Oct 2009 02:32:27 +0000 (02:32 +0000)
committerGunter Knauf <gk@gknw.de>
Wed, 14 Oct 2009 02:32:27 +0000 (02:32 +0000)
else ASN1_STRING_to_UTF8() returns the string length.

lib/ssluse.c

index 2ea3b2f559317f28e13c66bae5ac06997d8eab58..8cf834b14d639eff8590b8e6a4a55df5ffc7a1da 100644 (file)
@@ -1176,8 +1176,8 @@ static CURLcode verifyhost(struct connectdata *conn,
          conditional in the future when OpenSSL has been fixed. Work-around
          brought by Alexis S. L. Carvalho. */
       if(tmp) {
-        j = ASN1_STRING_length(tmp);
         if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) {
+          j = ASN1_STRING_length(tmp);
           if(j >= 0) {
             peer_CN = OPENSSL_malloc(j+1);
             if(peer_CN) {