diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2019-07-03 17:11:11 +0300 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2019-07-05 10:10:18 +0300 |
commit | b4b171877ece7da3dab869fb40019d493560097c (patch) | |
tree | 024179c9ced938ccf82715e80623afd62ddc8419 | |
parent | edb2ca969c53d580d1f853709278d15f1774da70 (diff) |
closeConnection() clears m_readBuffer, so that
`m_readBuffer.constData() + m_readPosition` accesses a disposed memory
Change-Id: Ide4e4d8fdafe81181fceb9ebe2692aaa25ba8034
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
-rw-r--r-- | src/mqtt/qmqttconnection.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mqtt/qmqttconnection.cpp b/src/mqtt/qmqttconnection.cpp index e3beb56..f207da4 100644 --- a/src/mqtt/qmqttconnection.cpp +++ b/src/mqtt/qmqttconnection.cpp @@ -706,6 +706,7 @@ void QMqttConnection::readBuffer(char *data, quint64 size) if (Q_UNLIKELY(quint64(m_readBuffer.size() - m_readPosition) < size)) { qCDebug(lcMqttConnection) << "Reaching out of buffer, protocol violation"; closeConnection(QMqttClient::ProtocolViolation); + return; } memcpy(data, m_readBuffer.constData() + m_readPosition, size); m_readPosition += size; |