fixeria submitted this change.

View Change

Approvals: osmith: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified
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
---
M src/common/l1sap.c
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 0598144..8bcd417 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -349,7 +349,7 @@
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 @@
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;

To view, visit change 29650. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie13d0724f183ff240714dcdbd24e5a21b4276bfe
Gerrit-Change-Number: 29650
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-CC: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged