From dc80401cbbfba7b086c1bacd3ed060d6f7fd6084 Mon Sep 17 00:00:00 2001 From: oana Date: Tue, 1 Jun 2021 14:00:14 +0000 Subject: [PATCH] Invalidate a SSLSocket in constructor if building a new SSL context fails. git-svn-id: http://voip.null.ro/svn/yate@6498 acf43c95-373e-0410-b603-e72c3f656dc1 --- modules/openssl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/openssl.cpp b/modules/openssl.cpp index 09269602..610bc932 100644 --- a/modules/openssl.cpp +++ b/modules/openssl.cpp @@ -423,6 +423,12 @@ SslSocket::SslSocket(SOCKET handle, bool server, int verify, SslContext* context context ? context->c_str() : "",this); if (Socket::valid()) { m_ssl = ::SSL_new(context ? *context : s_context); + if (!m_ssl) { + Debug(&__plugin,DebugNote,"SslSocket::SslSocket(%d) could not create SSL context, terminating [%p]", + handle,this); + Socket::terminate(); + return; + } if (s_index >= 0) ::SSL_set_ex_data(m_ssl,s_index,this); ::SSL_set_verify(m_ssl,verify,0);