a_iface: OSMO_ASSERT() if we ever want to send BSSAP with invalid length
Let's add a safeguard against sending BSSAP messages with invalid length values. This should never happen, and we'd rather see osmo-msc assert during the development cycle than ever releasing a version which sends invalid messages out on the wire. Change-Id: I94327a0d276c65b528a8c7e33dde61ed53582284 Related: OS#3805
This commit is contained in:
parent
9286114f6f
commit
31f4c1f927
|
@ -148,6 +148,19 @@ static int a_iface_tx_bssap(const struct ran_conn *conn, struct msgb *msg)
|
|||
OSMO_ASSERT(conn->a.scu);
|
||||
|
||||
LOGPCONN(conn, LOGL_DEBUG, "N-DATA.req(%s)\n", msgb_hexdump_l3(msg));
|
||||
|
||||
/* some consistency checks to ensure we don't send invalid length */
|
||||
switch (msg->l3h[0]) {
|
||||
case BSSAP_MSG_DTAP:
|
||||
OSMO_ASSERT(msgb_l3len(msg) == msg->l3h[2] + 3);
|
||||
break;
|
||||
case BSSAP_MSG_BSS_MANAGEMENT:
|
||||
OSMO_ASSERT(msgb_l3len(msg) == msg->l3h[1] + 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue