summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Leshenko <nikita@leshenko.net>2018-06-25 17:30:04 +0300
committerNikita Leshenko <nikita@leshenko.net>2018-06-25 19:12:29 +0300
commit05d89e728bfa8e3370b077888d8841ce59ee9bab (patch)
treebca8a63fc329427d8b576e0fb63764f3df47b0fb
parente6cdd17c846648aa8e1e025fa1988475886a551e (diff)
downloadlibgit2-05d89e728bfa8e3370b077888d8841ce59ee9bab.tar.gz
streams: openssl: Handle error in SSL_CTX_new
SIGSEGV otherwise...
-rw-r--r--src/streams/openssl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index 103e45f51..8a1befc21 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);