From 6ddbd501dd9bad0dda4f5dc4807135e560717a85 Mon Sep 17 00:00:00 2001 From: Martin Fong Date: Thu, 10 Nov 2022 17:06:47 -0800 Subject: [PATCH] * gsmmodem/pdu.py.Pdu._decodeUserData () corrected to correctly decode segmented SMS messages. --- gsmmodem/pdu.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gsmmodem/pdu.py b/gsmmodem/pdu.py index a3e28e8..0ec07e4 100644 --- a/gsmmodem/pdu.py +++ b/gsmmodem/pdu.py @@ -465,8 +465,11 @@ def _decodeUserData(byteIter, userDataLen, dataCoding, udhPresent): # Since we are using 7-bit data, "fill bits" may have been added to make the UDH end on a septet boundary shift = ((udhLen + 1) * 8) % 7 # "fill bits" needed to make the UDH end on a septet boundary # Simulate another "shift" in the unpackSeptets algorithm in order to ignore the fill bits - prevOctet = next(byteIter) - shift += 1 + if shift: + prevOctet = next(byteIter) + shift += 1 + else: + prevOctet = 0 if dataCoding == 0x00: # GSM-7 if udhPresent: