From dacacd206df0fa4bbb791135aed45bd3363bd555 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 13 Jul 2024 22:56:37 +0200 Subject: [PATCH] pySim.ota: Handle cases where 'secured_data' is empty while it's true that in situations where response_status == 'por_ok' we are guaranteed to have a 'secured_data' key in the dict, its value could well be b'', which in turn causes us to run into an exception, calling a decoder on an empty byte value; let's avoid that. Change-Id: I7c919f9987585d3b42347c54bd3082a54b8c2a0a --- pySim/ota.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim/ota.py b/pySim/ota.py index c3a7512c..00a4b6bc 100644 --- a/pySim/ota.py +++ b/pySim/ota.py @@ -478,7 +478,7 @@ class OtaDialectSms(OtaDialect): raise OtaCheckError('Unknown por_rc_cc_ds: %s' % spi['por_rc_cc_ds']) # TODO: ExpandedRemoteResponse according to TS 102 226 5.2.2 - if res.response_status == 'por_ok': + if res.response_status == 'por_ok' and len(res['secured_data']): dec = CompactRemoteResp.parse(res['secured_data']) else: dec = None