Commit 7285804161951f56554f7a96ef041642abe5da53
1 parent
ce14d163
Fix DISCONNECT packet parse bug
Showing
1 changed file
with
2 additions
and
1 deletions
mqttpacket.cpp
| @@ -983,9 +983,10 @@ DisconnectData MqttPacket::parseDisconnectData() | @@ -983,9 +983,10 @@ DisconnectData MqttPacket::parseDisconnectData() | ||
| 983 | if (this->protocolVersion >= ProtocolVersion::Mqtt5) | 983 | if (this->protocolVersion >= ProtocolVersion::Mqtt5) |
| 984 | { | 984 | { |
| 985 | if (!atEnd()) | 985 | if (!atEnd()) |
| 986 | - { | ||
| 987 | result.reasonCode = static_cast<ReasonCodes>(readUint8()); | 986 | result.reasonCode = static_cast<ReasonCodes>(readUint8()); |
| 988 | 987 | ||
| 988 | + if (!atEnd()) | ||
| 989 | + { | ||
| 989 | const size_t proplen = decodeVariableByteIntAtPos(); | 990 | const size_t proplen = decodeVariableByteIntAtPos(); |
| 990 | const size_t prop_end_at = pos + proplen; | 991 | const size_t prop_end_at = pos + proplen; |
| 991 | 992 |