diff options
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r-- | proto/bgp/packets.c | 3 |
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; |