diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2016-04-07 14:40:07 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2016-04-07 13:04:13 +0000 |
commit | ba9306ec5a1271275d79b2f48ceb227f79352f33 (patch) | |
tree | a18b37883ed1dc568029732e48fd56e3989a6bc8 /src | |
parent | a126127f2c2bc1c8f4c7e44ea543057397bbdafa (diff) | |
download | qtwebsockets-ba9306ec5a1271275d79b2f48ceb227f79352f33.tar.gz |
Fix possible hang on handshake
processHandShake operates on complete lines. If the data available does
not contain the full handshake message, the loop will therefore never return.
Task-number: QTBUG-51001
Change-Id: Ie87f5b5dee01116f463e84f06feab502ff5ac563
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index 0eadc93..2fd52fe 100644 --- a/src/websockets/qwebsocket_p.cpp +++ b/src/websockets/qwebsocket_p.cpp @@ -1142,10 +1142,13 @@ void QWebSocketPrivate::processData() { Q_ASSERT(m_pSocket); while (m_pSocket->bytesAvailable()) { - if (state() == QAbstractSocket::ConnectingState) + if (state() == QAbstractSocket::ConnectingState) { + if (!m_pSocket->canReadLine()) + break; processHandshake(m_pSocket); - else + } else { m_dataProcessor.process(m_pSocket); + } } } |