Skip to content

Commit 225ab37

Browse files
committed
Fix decoding of v5 messages with overall property length > 127 bytes.
Closes #541. Thanks to ochabloz.
1 parent 8945ee8 commit 225ab37

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ChangeLog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- Fix incoming MQTT v5 messages with overall property length > 127 bytes being
2+
incorrectly decoded. Closes #541.
3+
14
v1.5.1 - 2020x-09-22
25
===================
36

src/paho/mqtt/properties.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,10 @@ def unpack(self, buffer):
391391
buffer = buffer[VBIlen:] # strip the bytes used by the VBI
392392
propslenleft = propslen
393393
while propslenleft > 0: # properties length is 0 if there are none
394-
identifier, VBIlen = VariableByteIntegers.decode(
394+
identifier, VBIlen2 = VariableByteIntegers.decode(
395395
buffer) # property identifier
396-
buffer = buffer[VBIlen:] # strip the bytes used by the VBI
397-
propslenleft -= VBIlen
396+
buffer = buffer[VBIlen2:] # strip the bytes used by the VBI
397+
propslenleft -= VBIlen2
398398
attr_type = self.properties[identifier][0]
399399
value, valuelen = self.readProperty(
400400
buffer, attr_type, propslenleft)

0 commit comments

Comments
 (0)