laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/41733?usp=email )
Change subject: pySim.ts_51_011.EF_SMSP: Properly handle odd-length ScAddr /
TpAddr
......................................................................
pySim.ts_51_011.EF_SMSP: Properly handle odd-length ScAddr / TpAddr
As the input phone number ("address") might be of an odd length of
digits, let's use PaddedBcdAdapter to fix two problems:
1) strip any potential trailing f in decoding
2) fix truncation of last digit during encoding
Change-Id: I1e9865e172bc29b8a31c281106d903934e81c686
Depends: pyosmocom Ib5afb5ab5c2bc9b519dc92818fc6974f7eecba16
---
M pySim/ts_51_011.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/33/41733/1
diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index dcac60b..23e7f83 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -290,7 +290,7 @@
def __init__(self, fid='6f42', sfid=None, name='EF.SMSP', desc='Short
message service parameters', **kwargs):
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(28,
None), **kwargs)
ScAddr = Struct('length'/Rebuild(Int8ub, lambda ctx:
bytes_for_nibbles(len(ctx.call_number)) + 1),
- 'ton_npi'/TonNpi,
'call_number'/BcdAdapter(Rpad(Bytes(10))))
+ 'ton_npi'/TonNpi,
'call_number'/PaddedBcdAdapter(Rpad(Bytes(10))))
self._construct =
Struct('alpha_id'/COptional(GsmOrUcs2Adapter(Rpad(Bytes(this._.total_len-28)))),
'parameter_indicators'/InvertAdapter(BitStruct(
Const(7, BitsInteger(3)),
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41733?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1e9865e172bc29b8a31c281106d903934e81c686
Gerrit-Change-Number: 41733
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>