From: paco Date: Mon, 18 Jun 2018 10:23:28 +0000 (+0200) Subject: bgpd: null chk (Coverity 1433544 1433543 1433542) X-Git-Tag: frr-6.1-dev~302^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c37a11ad7206344de898f09a156ee6682499dde6;p=mirror%2Ffrr.git bgpd: null chk (Coverity 1433544 1433543 1433542) Signed-off-by: F. Aragon --- 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)