dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/29650 )
Change subject: l1sap: do not call msgb_l2hlen without checking ......................................................................
l1sap: do not call msgb_l2hlen without checking
We request the length zsing msgb_l2len() in two locations where whe cannot be sure that l2h is populated. Lets check this first.
Change-Id: Ie13d0724f183ff240714dcdbd24e5a21b4276bfe Related: OS#5645 --- M src/common/l1sap.c 1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/29650/1
diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 0598144..9c6616b 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -349,7 +349,9 @@ uint8_t chan_nr, link_id;
*data = msgb_l2(msg); - *len = msgb_l2len(msg); + *len = 0; + if (*data) + *len = msgb_l2len(msg); chan_nr = l1sap->u.data.chan_nr; link_id = l1sap->u.data.link_id;
@@ -391,7 +393,9 @@ struct msgb *msg = l1sap->oph.msg;
*data = msgb_l2(msg); - *len = msgb_l2len(msg); + *len = 0; + if (*data) + *len = msgb_l2len(msg);
if (L1SAP_IS_PTCCH(fn)) { *chan_type = GSMTAP_CHANNEL_PTCCH;