From 74a37991340685ff9cf7a7570da8360fd7189014 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Wed, 27 Apr 2022 15:28:47 +0200 Subject: [PATCH] Fix reading disconnect packets without reason code --- mqttpacket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index dcefcdf..0c424ab 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -801,10 +801,10 @@ void MqttPacket::handleDisconnect() if (this->protocolVersion >= ProtocolVersion::Mqtt5) { - reasonCode = static_cast(readByte()); - if (!atEnd()) { + reasonCode = static_cast(readByte()); + const size_t proplen = decodeVariableByteIntAtPos(); const size_t prop_end_at = pos + proplen; -- libgit2 0.21.4