From 565b73bbe457f2def84493bc4be12e9c59ce0f7e Mon Sep 17 00:00:00 2001 From: MadAlexUK <44322503+MadAlexUK@users.noreply.github.com> Date: Fri, 7 Dec 2018 01:21:18 +0000 Subject: [PATCH] Corrected segfault in TLS SNI code with OpenSSL in the case that callbacks are not used. (#315) --- src/data-types/mailstream_ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data-types/mailstream_ssl.c b/src/data-types/mailstream_ssl.c index e15d8563..a6901523 100644 --- a/src/data-types/mailstream_ssl.c +++ b/src/data-types/mailstream_ssl.c @@ -468,7 +468,7 @@ static struct mailstream_ssl_data * ssl_data_new_full(int fd, time_t timeout, goto free_ctx; #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) - if (ssl_context->server_name != NULL) { + if (ssl_context != NULL && ssl_context->server_name != NULL) { SSL_set_tlsext_host_name(ssl_conn, ssl_context->server_name); free(ssl_context->server_name); ssl_context->server_name = NULL;