summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-06-09 10:36:50 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-06-14 07:29:01 +0000
commit23173c725ce8b1c5b03498c9fa2bb334d40ec6f4 (patch)
tree3612dbad5d56b186d63d6f7c2786e06ecf9c588b /src
parente969e6d2ca5636b87b3de963ebd8dac993275617 (diff)
QSslSocket (OpenSSL) - handle abort/close on sslErrors emitted
If a user's code, attached to sslErrors signal, calls abort/close or disconnectFromHost but our SSL socket was configured not to verify a peer, no need to continue handshake after calling checkSslErrors (and finally crashing on invalid 'ssl' pointer). Task-number: QTBUG-53906 Change-Id: I7f185511d278f9d6f16e7d6c5ba424707141459c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 57cedf2c22..82644c155c 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1240,6 +1240,11 @@ bool QSslSocketBackendPrivate::startHandshake()
#endif
if (!checkSslErrors())
return false;
+ // A slot, attached to sslErrors signal can call
+ // abort/close/disconnetFromHost/etc; no need to
+ // continue handshake then.
+ if (q->state() != QAbstractSocket::ConnectedState)
+ return false;
} else {
sslErrors.clear();
}