Commit 05bf67b90186d2ad2c6c9adfa2c0024520cdb342

Patrick Steinhardt 2016-02-23T11:16:36

openssl_stream: fix NULL pointer dereference

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/openssl_stream.c b/src/openssl_stream.c
index 840e7dc..b713171 100644
--- a/src/openssl_stream.c
+++ b/src/openssl_stream.c
@@ -383,6 +383,8 @@ static int verify_server_cert(SSL *ssl, const char *host)
 			GITERR_CHECK_ALLOC(peer_cn);
 			memcpy(peer_cn, ASN1_STRING_data(str), size);
 			peer_cn[size] = '\0';
+		} else {
+			goto cert_fail_name;
 		}
 	} else {
 		int size = ASN1_STRING_to_UTF8(&peer_cn, str);