dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31737 )
Change subject: pcu_l1_if: do not copy IMSI when it is NULL ......................................................................
pcu_l1_if: do not copy IMSI when it is NULL
The parameter imsi of pcu_l1if_tx_pch_dt() could be NULL. In those cases we should ensure that struct gsm_pcu_if_pch_dt is populated with a zero length string.
Related: OS#5198 Change-Id: I9192d50dd78be0a72ffdb9bfb9ed66aef085bcf1 --- M src/pcu_l1_if.cpp 1 file changed, 17 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/37/31737/1
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index b501826..c08f0bd 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -299,10 +299,11 @@ * it is not guaranteed to work with other message types. The prepended TLLI will be used as an identifier in * the confirmation message. */
- struct gsm_pcu_if_pch_dt pch_dt; + struct gsm_pcu_if_pch_dt pch_dt = { 0 };
pch_dt.tlli = tlli; - strcpy(pch_dt.imsi, imsi); + if (imsi) + strcpy(pch_dt.imsi, imsi);
pch_dt.data[0] = (plen << 2) | 0x01; bitvec_pack(block, pch_dt.data + 1);