From 580edbc326268f0c3f4d0cbffeac963d06ffe8ac Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 28 Dec 2015 14:10:14 +0100 Subject: sched: Assert that the generated message is not empty Currently the msg data is accessed and index 0 assuming the msg is not empty. While this should be always the case, the msg can be empty if there are software errors in the message creation functions. This commit adds an assertion to catch this kind of bugs. Sponsored-by: On-Waves ehf --- src/gprs_rlcmac_sched.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index b4db88ce..8bf25734 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -330,6 +330,7 @@ int gprs_rlcmac_rcv_rts_block(struct gprs_rlcmac_bts *bts, /* msg is now available */ /* set USF */ + OSMO_ASSERT(msgb_length(msg) > 0); msg->data[0] = (msg->data[0] & 0xf8) | usf; /* Used to measure the leak rate, count all blocks */ -- cgit v1.2.3