diff options
| author | paco <paco@voltanet.io> | 2018-06-18 12:23:28 +0200 |
|---|---|---|
| committer | paco <paco@voltanet.io> | 2018-06-18 16:07:43 +0200 |
| commit | c37a11ad7206344de898f09a156ee6682499dde6 (patch) | |
| tree | 86204b2d7b35608368eb0f8308a734354bc7b6f7 | |
| parent | 6389e663e9b8971d5afa75d6afa18f5152c6de1b (diff) | |
bgpd: null chk (Coverity 1433544 1433543 1433542)
Signed-off-by: F. Aragon <paco@voltanet.io>
| -rw-r--r-- | bgpd/bgp_mpath.c | 2 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 3 | ||||
| -rw-r--r-- | lib/prefix.c | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 915387ca2d..333d09806e 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -471,7 +471,7 @@ void bgp_info_mpath_update(struct bgp_node *rn, struct bgp_info *new_best, zlog_debug( "%s: starting mpath update, newbest %s num candidates %d old-mpath-count %d", pfx_buf, new_best ? new_best->peer->host : "NONE", - listcount(mp_list), old_mpath_count); + mp_list ? listcount(mp_list) : 0, old_mpath_count); /* * We perform an ordered walk through both lists in parallel. diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index ccaa472092..18a979e531 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1733,7 +1733,8 @@ void rfapiPrintMatchingDescriptors(struct vty *vty, struct prefix *vn_prefix, int rfapiCliGetPrefixAddr(struct vty *vty, const char *str, struct prefix *p) { if (!str2prefix(str, p)) { - vty_out(vty, "Malformed address \"%s\"%s", str, HVTYNL); + vty_out(vty, "Malformed address \"%s\"%s", str ? str : "null", + HVTYNL); return CMD_WARNING; } switch (p->family) { diff --git a/lib/prefix.c b/lib/prefix.c index ed0774e774..b129665e7b 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -1197,6 +1197,9 @@ int str2prefix(const char *str, struct prefix *p) { int ret; + if (!str || !p) + return 0; + /* First we try to convert string to struct prefix_ipv4. */ ret = str2prefix_ipv4(str, (struct prefix_ipv4 *)p); if (ret) |
