summaryrefslogtreecommitdiff
path: root/proto/bgp/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-02-06 20:15:05 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2014-02-06 20:15:05 +0100
commit5c200e0a4d26d183e04fda43de16340521002c40 (patch)
treeb158b42840dbb723d9f34651f2f9971121d99eca /proto/bgp/packets.c
parent4a5eb284c9d51441e09976021d1bd93c21408d46 (diff)
parent080ed4d8c2c1982dd0c81c62703064b620a67a01 (diff)
Merge branch 'add-path'
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r--proto/bgp/packets.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 42064332..649d8078 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -244,7 +244,7 @@ bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsig
ip_addr a;
int bytes;
- while (!EMPTY_LIST(buck->prefixes) && remains >= (1+sizeof(ip_addr)))
+ while (!EMPTY_LIST(buck->prefixes) && (remains >= (5+sizeof(ip_addr))))
{
struct bgp_prefix *px = SKIP_BACK(struct bgp_prefix, bucket_node, HEAD(buck->prefixes));
DBG("\tDequeued route %I/%d\n", px->n.prefix, px->n.pxlen);
@@ -253,6 +253,7 @@ bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsig
{
put_u32(w, px->path_id);
w += 4;
+ remains -= 4;
}
*w++ = px->n.pxlen;