laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28940 )
Change subject: cbsp: Guard against malformed msgb without l1h,l2h being passed ......................................................................
cbsp: Guard against malformed msgb without l1h,l2h being passed
Change-Id: Ie8854c780cfd96e67df10c1fc38c6b99ec07422f --- M src/gsm/cbsp.c 1 file changed, 1 insertion(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved daniel: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/gsm/cbsp.c b/src/gsm/cbsp.c index c2a1b8d..81ba81e 100644 --- a/src/gsm/cbsp.c +++ b/src/gsm/cbsp.c @@ -1261,6 +1261,7 @@ * \returns callee-allocated decoded representation of CBSP message; NULL on error */ struct osmo_cbsp_decoded *osmo_cbsp_decode(void *ctx, struct msgb *in) { + OSMO_ASSERT(in->l1h != NULL && in->l2h != NULL); struct osmo_cbsp_decoded *out = talloc_zero(ctx, struct osmo_cbsp_decoded); const struct cbsp_header *h = msgb_l1(in); struct tlv_parsed tp[16]; /* max. number of pages in a given CBS message */