]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: handle depends_find() NULL nexthop
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 29 Oct 2019 01:37:05 +0000 (21:37 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Tue, 12 Nov 2019 15:28:46 +0000 (10:28 -0500)
SA warned us lookup could be NULL dereferenced in some
paths. Handle the case where we are passed a NULL
nexthop before we try to copy it.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c

index 05da25b2b8e28f8693d73639e993095264f465d9..7fe66ff77fc31e3d5a0479902348231a3fa8030a 100644 (file)
@@ -1000,6 +1000,9 @@ static struct nhg_hash_entry *depends_find(struct nexthop *nh, afi_t afi)
        struct nexthop *lookup = NULL;
        struct nhg_hash_entry *nhe = NULL;
 
+       if (!nh)
+               goto done;
+
        copy_nexthops(&lookup, nh, NULL);
 
        /* Clear it, in case its a group */
@@ -1012,6 +1015,7 @@ static struct nhg_hash_entry *depends_find(struct nexthop *nh, afi_t afi)
 
        nexthops_free(lookup);
 
+done:
        return nhe;
 }