pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bsc/+/40704?usp=email )
Change subject: sigtran: Avoid potential uninitialized ptr dereference
......................................................................
sigtran: Avoid potential uninitialized ptr dereference
Change-Id: I682567e88f61c9ec3cfa25c50f2c12fc9d1f6e4f
---
M src/osmo-bsc/osmo_bsc_sigtran.c
1 file changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/04/40704/1
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index 42e9a38..450b50e 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -97,15 +97,20 @@
/* Find an MSC by its remote SCCP address */
static struct bsc_msc_data *get_msc_by_addr(const struct osmo_sccp_addr *msc_addr)
{
- struct osmo_ss7_instance *ss7;
- struct bsc_msc_data *msc;
+ struct osmo_ss7_instance *ss7 = NULL;
+ struct bsc_msc_data *msc = NULL;
llist_for_each_entry(msc, msc_list, entry) {
if (memcmp(msc_addr, &msc->a.msc_addr, sizeof(*msc_addr)) == 0)
return msc;
}
- ss7 = osmo_ss7_instance_find(msc->a.cs7_instance);
- LOGP(DMSC, LOGL_ERROR, "Unable to find MSC data under address: %s\n",
osmo_sccp_addr_name(ss7, msc_addr));
+ /* Attempt getting an ss7_instance ptr to print sccp_addr: */
+ if (msc)
+ ss7 = osmo_ss7_instance_find(msc->a.cs7_instance);
+ if (!ss7)
+ ss7 = osmo_ss7_instance_find(0);
+ LOGP(DMSC, LOGL_ERROR, "Unable to find MSC data under address: %s\n",
+ ss7 ? osmo_sccp_addr_name(ss7, msc_addr) : "(no cs7 instance)");
return NULL;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/40704?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I682567e88f61c9ec3cfa25c50f2c12fc9d1f6e4f
Gerrit-Change-Number: 40704
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>