Commit 74a37991340685ff9cf7a7570da8360fd7189014
1 parent
4a702421
Fix reading disconnect packets without reason code
Showing
1 changed file
with
2 additions
and
2 deletions
mqttpacket.cpp
| ... | ... | @@ -801,10 +801,10 @@ void MqttPacket::handleDisconnect() |
| 801 | 801 | |
| 802 | 802 | if (this->protocolVersion >= ProtocolVersion::Mqtt5) |
| 803 | 803 | { |
| 804 | - reasonCode = static_cast<ReasonCodes>(readByte()); | |
| 805 | - | |
| 806 | 804 | if (!atEnd()) |
| 807 | 805 | { |
| 806 | + reasonCode = static_cast<ReasonCodes>(readByte()); | |
| 807 | + | |
| 808 | 808 | const size_t proplen = decodeVariableByteIntAtPos(); |
| 809 | 809 | const size_t prop_end_at = pos + proplen; |
| 810 | 810 | ... | ... |