diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2023-09-21 14:52:06 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2023-09-22 09:59:47 +0200 |
commit | e76efaa85343d2bb55c4966a542c2afc0e46aace (patch) | |
tree | da4d89478ebf938b85464a5a0969b03d8486d337 | |
parent | e0fa9b078600275e5ec4b4e41026f17161fe53af (diff) |
PCUIF_Components: ensure clean IMSI string
When receiving an IMSI from PCUIF (see type record PCUIF_pch), it is
represented as a null terminated string. The field is set to be 17
characters wide with a pdding of zeros at the end (as it ought to be
for a null terminated string). Unfortunately TTCN3 will not chop off
the trailing zeros, and also include them when the string length is
determined using lengthof(). This means we must take care of this
ourselves.
Let's use a regular expression to make sure any non numerical digits
are trimmed off before passing the IMSI string on to higher layers.
Related: OS#5927
Change-Id: I7bfea59a306e75211856e4e80985ebf000c42224
-rw-r--r-- | pcu/PCUIF_Components.ttcn | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pcu/PCUIF_Components.ttcn b/pcu/PCUIF_Components.ttcn index 01638b1a..d4179959 100644 --- a/pcu/PCUIF_Components.ttcn +++ b/pcu/PCUIF_Components.ttcn @@ -542,6 +542,8 @@ runs on RAW_PCU_BTS_CT { var octetstring data; var PCUIF_pch pch; var PCUIF_agch agch; + var charstring imsi_filter_regexp := "(\d*)"; /* numbers only */ + /* On PCH the payload is prefixed with paging group (3 octets): skip it. * TODO: add an additional template parameter, so we can match it. */ if (pcu_msg.u.data_req.sapi == PCU_IF_SAPI_PCH) { @@ -555,7 +557,7 @@ runs on RAW_PCU_BTS_CT { if (pcu_msg_rr.raw.sapi == PCU_IF_SAPI_PCH_2) { pch := dec_PCUIF_pch(pcu_msg_rr.raw.data); pcu_msg_rr.msg_id := pch.msg_id; - pcu_msg_rr.imsi := pch.imsi; + pcu_msg_rr.imsi := regexp(pch.imsi, imsi_filter_regexp, 0); pcu_msg_rr.rr_msg := dec_GsmRrMessage(pch.data); pcu_msg_rr.confirm := pch.confirm; } else if (pcu_msg_rr.raw.sapi == PCU_IF_SAPI_AGCH_2) { |