Fixes potential alignment bug in BGP.

Thanks to Andrew (seti.kr.ua) for the bug report.
This commit is contained in:
Ondrej Zajicek 2015-02-21 12:24:30 +01:00
parent 523f020b5f
commit dfc7a6c6a0

View file

@ -717,7 +717,7 @@ bgp_new_bucket(struct bgp_proto *p, ea_list *new, unsigned hash)
struct bgp_bucket *b; struct bgp_bucket *b;
unsigned ea_size = sizeof(ea_list) + new->count * sizeof(eattr); unsigned ea_size = sizeof(ea_list) + new->count * sizeof(eattr);
unsigned ea_size_aligned = BIRD_ALIGN(ea_size, CPU_STRUCT_ALIGN); unsigned ea_size_aligned = BIRD_ALIGN(ea_size, CPU_STRUCT_ALIGN);
unsigned size = sizeof(struct bgp_bucket) + ea_size; unsigned size = sizeof(struct bgp_bucket) + ea_size_aligned;
unsigned i; unsigned i;
byte *dest; byte *dest;
unsigned index = hash & (p->hash_size - 1); unsigned index = hash & (p->hash_size - 1);