]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix a64448ba, invalid NULL->num_labels
authorVincent JARDIN <vincent.jardin@6wind.com>
Mon, 9 Oct 2017 10:32:05 +0000 (12:32 +0200)
committerVincent JARDIN <vincent.jardin@6wind.com>
Mon, 9 Oct 2017 10:32:05 +0000 (12:32 +0200)
We should assume match OK only when neither nhl1
and neither nhl2 are NULL.
If both are NULL, it means match NOK.

Clang Warning:
  Access to field 'num_labels' results in a dereference of a null
  pointer (loaded from variable 'nhl1')

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
lib/nexthop.c

index ea6a310a4a139ac554a45d19ef392dc5bee61340..f6b2c9788d50a4757649f76d12b593ad821cbcbb 100644 (file)
@@ -128,7 +128,7 @@ int nexthop_labels_match(struct nexthop *nh1, struct nexthop *nh2)
 
        nhl1 = nh1->nh_label;
        nhl2 = nh2->nh_label;
-       if ((nhl1 && !nhl2) || (!nhl1 && nhl2))
+       if (!nhl1 || !nhl2)
                return 0;
 
        if (nhl1->num_labels != nhl2->num_labels)