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
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 84d39cb..bbeb3aa 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -294,10 +294,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)
+ OSMO_STRLCPY_ARRAY(pch_dt.imsi, imsi);
pch_dt.data[0] = (plen << 2) | 0x01;
bitvec_pack(block, pch_dt.data + 1);