Skip to content

Commit 2e69b8e

Browse files
committed
Fix PUBREL remaining length of > 2 not being accepted for MQTT v5 message flows.
Closes #481. Thanks to Tao Su.
1 parent 64de050 commit 2e69b8e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ChangeLog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ v1.x.x - 20xx-xx-xx
44
- Exceptions that occur in callbacks are no longer suppressed by default. They
55
can optionally be suppressed by setting `client.suppress_exceptions = True`.
66
Closes #365.
7+
- Fix PUBREL remaining length of > 2 not being accepted for MQTT v5 message
8+
flows. Closes #481.
79

810
v1.5.0 - 2019-10-30
911
===================

src/paho/mqtt/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3229,7 +3229,10 @@ def _handle_publish(self):
32293229
return MQTT_ERR_PROTOCOL
32303230

32313231
def _handle_pubrel(self):
3232-
if self._in_packet['remaining_length'] != 2:
3232+
if self._protocol == MQTTv5:
3233+
if self._in_packet['remaining_length'] < 2:
3234+
return MQTT_ERR_PROTOCOL
3235+
elif self._in_packet['remaining_length'] != 2:
32333236
return MQTT_ERR_PROTOCOL
32343237

32353238
mid, = struct.unpack("!H", self._in_packet['packet'])

0 commit comments

Comments
 (0)