diff options
| author | Nigel Kukard <nkukard@lbsd.net> | 2017-08-31 09:27:46 +0000 |
|---|---|---|
| committer | Nigel Kukard <nkukard@lbsd.net> | 2017-08-31 23:39:53 +0000 |
| commit | 3ac053e608b63041afbf0080f03670d4b56e7fef (patch) | |
| tree | 28979c2e0d0e72c5887c1feb27539733d13d3901 | |
| parent | 534fc1957bd5f2d4985a2633540eed3182bb8ef9 (diff) | |
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>
| -rw-r--r-- | bgpd/bgp_lcommunity.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c index fd734b2c5b..f464e7122d 100644 --- a/bgpd/bgp_lcommunity.c +++ b/bgpd/bgp_lcommunity.c @@ -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; } |
