]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd isisd: null check (Clang scan)
authorF. Aragon <paco@voltanet.io>
Fri, 29 Jun 2018 15:14:23 +0000 (17:14 +0200)
committerF. Aragon <paco@voltanet.io>
Fri, 29 Jun 2018 15:51:44 +0000 (17:51 +0200)
This correction fixes three bugs detected by Clang scan:

Bug Group: Logic error
Bug Type: Dereference of null pointer

File: bgpd/bgp_evpn.c
Function: bgp_evpn_unconfigure_import_rt_for_vrf
Line: 4246

File: isisd/isis_spf.c
Function: isis_print_paths
Line: 69 (two bugs of same type in one line)

Signed-off-by: F. Aragon <paco@voltanet.io>
bgpd/bgp_evpn.c
isisd/isis_spf.c

index 0557bbcce9a59efd3e55a2ad9037f4b1426e49b5..480c7bc63acdbc329e5d70c727d6c8d31d2c6325 100644 (file)
@@ -4243,7 +4243,7 @@ void bgp_evpn_unconfigure_import_rt_for_vrf(struct bgp *bgp_vrf,
                list_delete_node(bgp_vrf->vrf_import_rtl, node_to_del);
 
        /* fallback to auto import rt, if this was the last RT */
-       if (list_isempty(bgp_vrf->vrf_import_rtl)) {
+       if (bgp_vrf->vrf_import_rtl && list_isempty(bgp_vrf->vrf_import_rtl)) {
                UNSET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD);
                evpn_auto_rt_import_add_for_vrf(bgp_vrf);
        }
index 2e2933db332b5925850a3b4d9cf1ade228b61c8b..556f2890cfbc22caee61a27ed0783f72bb3e799c 100644 (file)
@@ -1473,8 +1473,9 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue,
                vty_out(vty, "%-20s %-12s %-6u ",
                        vid2string(vertex, buff, sizeof(buff)),
                        vtype2string(vertex->type), vertex->d_N);
-               for (unsigned int i = 0; i < MAX(listcount(vertex->Adj_N),
-                                                listcount(vertex->parents));
+               for (unsigned int i = 0;
+                    i < MAX(vertex->Adj_N ? listcount(vertex->Adj_N) : 0,
+                            vertex->parents ? listcount(vertex->parents) : 0);
                     i++) {
                        if (anode) {
                                adj = listgetdata(anode);