]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: null chk (Coverity 1433544 1433543 1433542)
authorpaco <paco@voltanet.io>
Mon, 18 Jun 2018 10:23:28 +0000 (12:23 +0200)
committerpaco <paco@voltanet.io>
Mon, 18 Jun 2018 14:07:43 +0000 (16:07 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
bgpd/bgp_mpath.c
bgpd/rfapi/rfapi_vty.c
lib/prefix.c

index 915387ca2defc86c42030743f8686fcb9c847fd7..333d09806e29af2c56a8a0f128d4d016ed3357af 100644 (file)
@@ -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.
index ccaa472092d37e3c3b1873b13ef34c712c15016d..18a979e531ea26c6ba09072d68cc2ceede9b63e0 100644 (file)
@@ -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) {
index ed0774e77495b03415aef24c2f5d524d3e0fe1dd..b129665e7b46c041418ba2e3965900efb3477afc 100644 (file)
@@ -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)