From 2fea72c75148459a5caa8aed08dadeabdcb0887e Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 10 Aug 2018 12:41:04 +0200 Subject: Fix subscription for retained messages readVariableByteInteger returns the amount of bytes to come, not the bytes read to receive this value. Change-Id: I02b55622f2f668dcc582556087bb2fd78b53957d Reviewed-by: hjk --- src/mqtt/qmqttconnection.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mqtt/qmqttconnection.cpp b/src/mqtt/qmqttconnection.cpp index 7092249..69e153b 100644 --- a/src/mqtt/qmqttconnection.cpp +++ b/src/mqtt/qmqttconnection.cpp @@ -965,9 +965,10 @@ void QMqttConnection::readPublishProperties(QMqttPublishProperties &properties) void QMqttConnection::readSubscriptionProperties(QMqttSubscription *sub) { - qint64 propertyLength = readVariableByteInteger(); + qint32 bytes = 0; + qint64 propertyLength = readVariableByteInteger(&bytes); - m_missingData -= propertyLength; + m_missingData -= bytes; while (propertyLength > 0) { const quint8 propertyId = readBufferTyped(&propertyLength); switch (propertyId) { -- cgit v1.2.3