Commit 05d89e728bfa8e3370b077888d8841ce59ee9bab

Nikita Leshenko 2018-06-25T17:30:04

streams: openssl: Handle error in SSL_CTX_new SIGSEGV otherwise...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index 103e45f..8a1befc 100644
--- a/src/streams/openssl.c
+++ b/src/streams/openssl.c
@@ -219,6 +219,10 @@ int git_openssl_stream_global_init(void)
 	 * to speak TLSv1 to perform the encryption itself.
 	 */
 	git__ssl_ctx = SSL_CTX_new(SSLv23_method());
+	if (!git__ssl_ctx) {
+		return -1;
+	}
+
 	SSL_CTX_set_options(git__ssl_ctx, ssl_opts);
 	SSL_CTX_set_mode(git__ssl_ctx, SSL_MODE_AUTO_RETRY);
 	SSL_CTX_set_verify(git__ssl_ctx, SSL_VERIFY_NONE, NULL);