From 1f46f07e3c1d793ca334520786fad4ec90e83916 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 27 Jul 2023 10:38:38 +0200 Subject: [PATCH] utils: tolerate uninitialized fields in dec_addr_tlv TLV fields holding an address may still be uninitialized and hence filled with 0xff bytes. Lets interpret those fields in the same way as we interpret empty fields. Related: OS#6094 Change-Id: Idc0a92ea88756266381c8da2ad62de061a8ea7a1 --- pySim/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pySim/utils.py b/pySim/utils.py index 735468e8..1541e2e6 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -771,6 +771,10 @@ def dec_addr_tlv(hexstr): if tlv[1] == 0: continue + # Uninitialized field + if all([v == 0xff for v in tlv[2]]): + continue + # First byte in the value has the address type addr_type = tlv[2][0] # TODO: Support parsing of IPv6