]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Fix label-stack comparison for nexthops
authorMark Stapp <mjs@voltanet.io>
Wed, 7 Apr 2021 14:08:46 +0000 (10:08 -0400)
committerMark Stapp <mjs@voltanet.io>
Wed, 7 Apr 2021 14:21:39 +0000 (10:21 -0400)
Use the correct number of octets in the comparison of
nexthops' label stacks.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
lib/nexthop.c

index facb83f6d50bb1e17aa392beabf225bafd7b3269..3b6ad0e54c0e037354d91210f418d5baa3a83bf2 100644 (file)
@@ -62,7 +62,8 @@ static int _nexthop_labels_cmp(const struct nexthop *nh1,
        if (nhl1->num_labels < nhl2->num_labels)
                return -1;
 
-       return memcmp(nhl1->label, nhl2->label, nhl1->num_labels);
+       return memcmp(nhl1->label, nhl2->label,
+                     (nhl1->num_labels * sizeof(mpls_label_t)));
 }
 
 int nexthop_g_addr_cmp(enum nexthop_types_t type, const union g_addr *addr1,