diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2022-10-06 18:18:22 +0200 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-10-12 18:19:25 +0700 |
commit | 59e147e7ad89561957f7d3a4c8bfcce721c514ed (patch) | |
tree | 72b20713863557a056539c754807e90127ad745f | |
parent | 0087a1137ebaa870cad23fec8d19a51c6843de56 (diff) |
l1sap: do not call msgb_l2hlen without checking
We request the length using msgb_l2len() in two locations where whe
cannot be sure that l2h is populated. Lets check this first.
Change-Id: Ie13d0724f183ff240714dcdbd24e5a21b4276bfe
Related: OS#5645
-rw-r--r-- | src/common/l1sap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 0598144b..8bcd4171 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -349,7 +349,7 @@ static int gsmtap_ph_data(const struct osmo_phsap_prim *l1sap, uint8_t chan_nr, link_id; *data = msgb_l2(msg); - *len = msgb_l2len(msg); + *len = msgb_l2(msg) ? msgb_l2len(msg) : 0; chan_nr = l1sap->u.data.chan_nr; link_id = l1sap->u.data.link_id; @@ -391,7 +391,7 @@ static int gsmtap_pdch(const struct osmo_phsap_prim *l1sap, struct msgb *msg = l1sap->oph.msg; *data = msgb_l2(msg); - *len = msgb_l2len(msg); + *len = msgb_l2(msg) ? msgb_l2len(msg) : 0; if (L1SAP_IS_PTCCH(fn)) { *chan_type = GSMTAP_CHANNEL_PTCCH; |