pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/31812 )

Change subject: Assert conn_id being looked up is inside expected range
......................................................................

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(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/osmo-bsc/lb.c b/src/osmo-bsc/lb.c
index c34d88e..6e2d074 100644
--- a/src/osmo-bsc/lb.c
+++ b/src/osmo-bsc/lb.c
@@ -36,6 +36,9 @@
 {
        struct gsm_subscriber_connection *conn;

+       /* Range (0..SCCP_CONN_ID_MAX) expected, see 
bsc_sccp_inst_next_conn_id() */
+       OSMO_ASSERT(conn_id <= SCCP_CONN_ID_MAX);
+
        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 1d4fe82..973832b 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(const struct 
osmo_sccp_user *scu, uint32_t conn_id)
 {
-       conn_id &= SCCP_CONN_ID_MAX;
        struct gsm_subscriber_connection *conn;
        const struct osmo_sccp_instance *sccp = osmo_sccp_get_sccp(scu);

+       /* Range (0..SCCP_CONN_ID_MAX) expected, see 
bsc_sccp_inst_next_conn_id() */
+       OSMO_ASSERT(conn_id <= SCCP_CONN_ID_MAX);
+
        llist_for_each_entry(conn, &bsc_gsmnet->subscr_conns, entry) {
                if (conn->sccp.msc && conn->sccp.msc->a.sccp != sccp)
                        continue;

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31812
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iffe580ad5f974fdbef7061a14306b50bd4875eb1
Gerrit-Change-Number: 31812
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to