diff --git a/lib/ssluse.c b/lib/ssluse.c index 0b98ba0b6e61a4e43c6d8f92acecd4b21ca42ff3..07824b411852413094bf0a2b5cc87112b6cc18d9 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -1178,7 +1178,7 @@ static CURLcode verifyhost(struct connectdata *conn, else /* not a UTF8 name */ j = ASN1_STRING_to_UTF8(&peer_CN, tmp); - if((int)strlen((char *)peer_CN) != j) { + if(peer_CN && ((int)strlen((char *)peer_CN) != j)) { /* there was a terminating zero before the end of string, this cannot match and we return failure! */ failf(data, "SSL: illegal cert name field");