cbsp: Guard against malformed msgb without l1h,l2h being passed
Change-Id: Ie8854c780cfd96e67df10c1fc38c6b99ec07422f
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 */