pespin has uploaded this change for review.
Assert conn_id being looked up is inside expected range
Change-Id: Iffe580ad5f974fdbef7061a14306b50bd4875eb1
---
M src/osmo-bsc/lb.c
M src/osmo-bsc/osmo_bsc_sigtran.c
2 files changed, 15 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/12/31812/1
diff --git a/src/osmo-bsc/lb.c b/src/osmo-bsc/lb.c
index ce28ebc..b810d49 100644
--- a/src/osmo-bsc/lb.c
+++ b/src/osmo-bsc/lb.c
@@ -36,6 +36,9 @@
{
struct gsm_subscriber_connection *conn;
+ /* Range 0..0xFFFFFFFE expected, see bsc_sccp_inst_next_conn_id() */
+ OSMO_ASSERT(conn_id < 0x00FFFFFF);
+
llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) {
if (conn->lcs.lb.state != SUBSCR_SCCP_ST_NONE
&& conn->lcs.lb.conn_id == conn_id)
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index fc5a5fe..46a0667 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -48,10 +48,12 @@
/* Helper function to Check if the given connection id is already assigned */
static struct gsm_subscriber_connection *get_bsc_conn_by_conn_id(struct osmo_sccp_user *scu, uint32_t conn_id)
{
- conn_id &= 0x00FFFFFF;
struct gsm_subscriber_connection *conn;
struct osmo_sccp_instance *sccp = osmo_sccp_get_sccp(scu);
+ /* Range 0..0xFFFFFFFE expected, see bsc_sccp_inst_next_conn_id() */
+ OSMO_ASSERT(conn_id < 0x00FFFFFF);
+
llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) {
if (conn->sccp.msc && conn->sccp.msc->a.sccp != sccp)
continue;
To view, visit change 31812. To unsubscribe, or for help writing mail filters, visit settings.