pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
tcap_as_loadshare_vty: Avoid possible NULL pointer dereference

argv[1]/as_name is always set so the `if (as_name)` guard can be
removed. This lets Coverity verify that as is never dereferenced if
NULL.

Related: Coverity CID#551555
Change-Id: Ia9151ae63be3977c2eccf246316b99c20284dbe2
---
M src/tcap_as_loadshare_vty.c
1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/tcap_as_loadshare_vty.c b/src/tcap_as_loadshare_vty.c
index dcd8ccf..e6506e8 100644
--- a/src/tcap_as_loadshare_vty.c
+++ b/src/tcap_as_loadshare_vty.c
@@ -66,12 +66,10 @@
return CMD_WARNING;
}

- if (as_name) {
- as = osmo_ss7_as_find_by_name(inst, as_name);
- if (!as) {
- vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ as = osmo_ss7_as_find_by_name(inst, as_name);
+ if (!as) {
+ vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE);
+ return CMD_WARNING;
}

vty_out(vty, "Tid Min Tid Max SSN PC ASP Name %s", VTY_NEWLINE);
@@ -108,12 +106,10 @@
return CMD_WARNING;
}

- if (as_name) {
- as = osmo_ss7_as_find_by_name(inst, as_name);
- if (!as) {
- vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ as = osmo_ss7_as_find_by_name(inst, as_name);
+ if (!as) {
+ vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE);
+ return CMD_WARNING;
}

vty_out(vty, "Tid Min Tid Max SSN PC ASP Name %s", VTY_NEWLINE);

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

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ia9151ae63be3977c2eccf246316b99c20284dbe2
Gerrit-Change-Number: 41539
Gerrit-PatchSet: 2
Gerrit-Owner: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>