]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fixed incorrect calculation of pointer location
authorNigel Kukard <nkukard@lbsd.net>
Wed, 30 Aug 2017 09:39:36 +0000 (09:39 +0000)
committerNigel Kukard <nkukard@lbsd.net>
Thu, 31 Aug 2017 23:39:53 +0000 (23:39 +0000)
com_index_to_delete[i] holds the location in lcom->val of where the
value is stored, we cannot just increment it by this value on each
iteration as we'll overflow the size of lcom->val.

Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
bgpd/bgp_clist.c

index 7104f17e5ebdeada7a438627d5769c733fc69f7f..162ea59a069eb7f3ffe645c2d30581f9dae3a969 100644 (file)
@@ -941,9 +941,8 @@ struct lcommunity *lcommunity_list_match_delete(struct lcommunity *lcom,
        }
 
        /* Delete all of the communities we flagged for deletion */
-       ptr = lcom->val;
        for (i = delete_index - 1; i >= 0; i--) {
-               ptr += (com_index_to_delete[i] * LCOMMUNITY_SIZE);
+               ptr = lcom->val + (com_index_to_delete[i] * LCOMMUNITY_SIZE);
                lcommunity_del_val(lcom, ptr);
        }