From: Vincent JARDIN Date: Mon, 9 Oct 2017 10:32:05 +0000 (+0200) Subject: lib: fix a64448ba, invalid NULL->num_labels X-Git-Tag: frr-4.0-dev~230^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3f58e1b3e79090f29f8b4b75bb529d54ba719c26;p=mirror%2Ffrr.git lib: fix a64448ba, invalid NULL->num_labels 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 --- diff --git a/lib/nexthop.c b/lib/nexthop.c index ea6a310a4a..f6b2c9788d 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -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)