laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved laforge: Looks good to me, approved
bsc_nat_print_addr: handle NULL

Fixes: Coverity CID#273006, CID#273005
Fixes: OS#5597
Change-Id: I37cfc7ae32d85142d73b523b2f13b94a0bffba7a
---
M src/osmo-bsc-nat/bsc_nat.c
M src/osmo-bsc-nat/bsc_nat_fsm.c
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/osmo-bsc-nat/bsc_nat.c b/src/osmo-bsc-nat/bsc_nat.c
index 3ae7881..7b4b8be 100644
--- a/src/osmo-bsc-nat/bsc_nat.c
+++ b/src/osmo-bsc-nat/bsc_nat.c
@@ -98,6 +98,9 @@
{
static char buf[25];

+ if (!addr)
+ return NULL;
+
snprintf(buf, sizeof(buf), "PC=%s in %s", osmo_ss7_pointcode_print(NULL, addr->pc),
net == BSC_NAT_NET_CN ? "CN" : "RAN");

diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c
index d7f8aa3..96f1564 100644
--- a/src/osmo-bsc-nat/bsc_nat_fsm.c
+++ b/src/osmo-bsc-nat/bsc_nat_fsm.c
@@ -80,7 +80,7 @@
{
struct bsc_nat_sccp_inst *sccp_inst = osmo_sccp_user_get_priv(scu);
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
- struct osmo_sccp_addr *addr; /* MSC's address */
+ struct osmo_sccp_addr *addr = NULL; /* MSC's address */
struct subscr_conn *subscr_conn;
int rc = -1;

@@ -170,7 +170,7 @@
{
struct bsc_nat_sccp_inst *sccp_inst = osmo_sccp_user_get_priv(scu);
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
- struct osmo_sccp_addr *addr; /* BSC's address */
+ struct osmo_sccp_addr *addr = NULL; /* BSC's address */
struct subscr_conn *subscr_conn;
struct msc *msc;
struct bsc *bsc;

To view, visit change 28581. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: I37cfc7ae32d85142d73b523b2f13b94a0bffba7a
Gerrit-Change-Number: 28581
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged