summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Melnikov <alexey.melnikov@isode.com>2017-06-19 12:01:54 (GMT)
committerAlexey Melnikov <alexey.melnikov@isode.com>2017-06-19 13:22:51 (GMT)
commitb807e3fa975cf25e5e901b59643419a5a73a12fe (patch)
treebe442c5e7fe96122c8c8324d8266085aa95c6524 /Swiften/TLS
parentb8c1d6fb59bd4ae528d807fc30b02dab45aafabf (diff)
downloadswift-b807e3fa975cf25e5e901b59643419a5a73a12fe.zip
swift-b807e3fa975cf25e5e901b59643419a5a73a12fe.tar.bz2
Don't crash when SSL_new fails
NULL pointer dereference was happening in OpenSSL code (inside SSL_set_bio) when SSL_new returned NULL due to lack of Isode HGE license. Change-Id: Iebd78be7eb6c7978de0bff225915dc393a516f08
Diffstat (limited to 'Swiften/TLS')
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
index cd6b6bc..0805917 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
@@ -121,6 +121,12 @@ void OpenSSLContext::ensureLibraryInitialized() {
void OpenSSLContext::connect() {
handle_ = SSL_new(context_);
+ if (handle_ == nullptr) {
+ state_ = Error;
+ onError(std::make_shared<TLSError>());
+ return;
+ }
+
// Ownership of BIOs is ransferred
readBIO_ = BIO_new(BIO_s_mem());
writeBIO_ = BIO_new(BIO_s_mem());