jolly has uploaded this change for review. (
https://gerrit.osmocom.org/c/python/pyosmocom/+/40423?usp=email )
Change subject: Corrected decoding of MSISDN IE and IMEI IE
......................................................................
Corrected decoding of MSISDN IE and IMEI IE
1 2 3 4 5 6 7 8
+-------------------------------+
| MSISDN IE type |Res| octet 1
+-------------------------------+
| Length of IE content | octet 2
+-------------------------------+
| Length of BCD content | octet 3
+-------------------------------+
| Digit 1 | Digit 2 | octet 4..n
| .... | |
+-------------------------------+
The length of the BCD content specifies how many subsequent octets
contain BCD data, but it does not indicate the number of digits.
This length must be less than the total length of the IE content.
Any octets following the BCD content shall be ignored.
Related: OS#6797
Change-Id: Idd2bee3d8f662d028001392cfd0332a265fbc91a
---
M src/osmocom/gsup/message.py
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/23/40423/1
diff --git a/src/osmocom/gsup/message.py b/src/osmocom/gsup/message.py
index 8ab7881..e48cd54 100644
--- a/src/osmocom/gsup/message.py
+++ b/src/osmocom/gsup/message.py
@@ -133,8 +133,7 @@
_construct = None # empty
class MSISDN(GSUP_TLV_IE, tag=0x08):
- # TODO: do all existing implementations use ton/npi?
- _construct = Struct('ton_npi'/TonNpi,
'digits'/PaddedBcdAdapter(GreedyBytes))
+ _construct = Struct('bcd_len'/Byte,
'digits'/PaddedBcdAdapter(Bytes(this.bcd_len)))
class HlrNumber(GSUP_TLV_IE, tag=0x09):
_construct = Struct('ton_npi'/TonNpi,
'digits'/PaddedBcdAdapter(GreedyBytes))
@@ -185,7 +184,7 @@
_construct = Enum(Int8ub, ms_present=1, memory_available=2)
class IMEI(GSUP_TLV_IE, tag=0x50):
- _construct = PaddedBcdAdapter(GreedyBytes)
+ _construct = Struct('bcd_len'/Byte,
'digits'/PaddedBcdAdapter(Bytes(this.bcd_len)))
class ImeiCheckResult(GSUP_TLV_IE, tag=0x51):
_construct = Enum(Int8ub, ack=0, nack=1)
--
To view, visit
https://gerrit.osmocom.org/c/python/pyosmocom/+/40423?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: Idd2bee3d8f662d028001392cfd0332a265fbc91a
Gerrit-Change-Number: 40423
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>