dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41236?usp=email )
Change subject: commands: do not use b2h with a string ......................................................................
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 --- M pySim/commands.py 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/36/41236/1
diff --git a/pySim/commands.py b/pySim/commands.py index f069db4..e5ad564 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -141,10 +141,10 @@ Returns: Tuple of (decoded_data, sw) """ - cmd = cmd_constr.build(cmd_data) if cmd_data else '' + cmd = b2h(cmd_constr.build(cmd_data)) if cmd_data else '' lc = i2h([len(cmd)]) if cmd_data else '' le = '00' if resp_constr else '' - pdu = ''.join([cla, ins, p1, p2, lc, b2h(cmd), le]) + pdu = ''.join([cla, ins, p1, p2, lc, cmd, le]) (data, sw) = self.send_apdu(pdu, apply_lchan = apply_lchan) if data: # filter the resulting dict to avoid '_io' members inside