laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc-nat/+/28581 )
Change subject: bsc_nat_print_addr: handle NULL ......................................................................
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(-)
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
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;