Skip to content

Commit 059a1b6

Browse files
committed
Fix decode for wrong mdap len.
1 parent 1cfc681 commit 059a1b6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pymodbus/message/socket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def decode(self, data: bytes) -> tuple[int, int, int, bytes]:
3131
if used_len < msg_len:
3232
Log.debug("Short frame: {} wait for more data", data, ":hex")
3333
return 0, 0, 0, self.EMPTY
34+
if msg_len == 8 and used_len == 9:
35+
msg_len = 9
3436
return msg_len, msg_tid, msg_dev, data[7:msg_len]
3537

3638
def encode(self, data: bytes, device_id: int, tid: int) -> bytes:

0 commit comments

Comments
 (0)