From 1ab2f8dd9de5f2610700d5ef4e7ebd013dd9ec39 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 21 Oct 2025 16:48:59 +0200 Subject: [PATCH] commands: do not use b2h with a string The function h2b expects a bytearray and must not be used on a string. This is also true for nullstrings (''). Related: OS#6869 Change-Id: I0e28e6ec476901bf19aa0f8640e41c74aa6e3aa2 --- pySim/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim/commands.py b/pySim/commands.py index f069db4b..066a2c48 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -141,7 +141,7 @@ class SimCardCommands: Returns: Tuple of (decoded_data, sw) """ - cmd = cmd_constr.build(cmd_data) if cmd_data else '' + cmd = cmd_constr.build(cmd_data) if cmd_data else b'' lc = i2h([len(cmd)]) if cmd_data else '' le = '00' if resp_constr else '' pdu = ''.join([cla, ins, p1, p2, lc, b2h(cmd), le])