bgpd: Fixed pointer arithmatic miscalculation

If we increment PTR by i * size each time, we end up doing 1, 3, 6
etc.

Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
This commit is contained in:
Nigel Kukard 2017-08-31 09:27:46 +00:00
parent 534fc1957b
commit 3ac053e608

View File

@ -398,9 +398,8 @@ int lcommunity_include(struct lcommunity *lcom, u_char *ptr)
int i;
u_char *lcom_ptr;
lcom_ptr = lcom->val;
for (i = 0; i < lcom->size; i++) {
lcom_ptr += (i * LCOMMUNITY_SIZE);
lcom_ptr = lcom->val + (i * LCOMMUNITY_SIZE);
if (memcmp(ptr, lcom_ptr, LCOMMUNITY_SIZE) == 0)
return 1;
}