From 0c40a2245b79f53d1de94d2807e2763b28adbb27 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 13 Jul 2024 22:58:44 +0200 Subject: [PATCH] pySim.ota: Raise exception if encoded length would exceed 140 bytes SMS cannot exceed 140 bytes, and TS 31.115 explicitly states that larger messages must use multi-part SMS, which we don't yet implement here. Change-Id: I8a1543838be2add1c3cfdf7155676cf2b9827e6e --- pySim/ota.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pySim/ota.py b/pySim/ota.py index 00a4b6bc..751461a0 100644 --- a/pySim/ota.py +++ b/pySim/ota.py @@ -386,6 +386,9 @@ class OtaDialectSms(OtaDialect): #print("envelope_data: %s" % b2h(envelope_data)) + if len(envelope_data) > 140: + raise ValueError('Cannot encode command in a single SMS; Fragmentation not implemented') + return envelope_data def decode_cmd(self, otak: OtaKeyset, encoded: bytes) -> Tuple[bytes, dict, bytes]: