laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37484?usp=email )
Change subject: pySim.ota: Raise exception if encoded length would exceed 140 bytes ......................................................................
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 --- M pySim/ota.py 1 file changed, 15 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/pySim/ota.py b/pySim/ota.py index 00a4b6b..751461a 100644 --- a/pySim/ota.py +++ b/pySim/ota.py @@ -386,6 +386,9 @@
#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]: