From: Ondrej Zajicek (work) Date: Wed, 25 Nov 2020 14:44:00 +0000 (+0100) Subject: BGP: Zero the newly allocated bucket structure X-Git-Tag: v2.0.8~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=246586771296d1c42a012c06bdc75b36a7ce0b4f;p=thirdparty%2Fbird.git BGP: Zero the newly allocated bucket structure This fixes an issue with dirty node passed to add_tail(). Thanks to Andreas Rammhold for the initial patch. --- diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 828bc1187..b2c373010 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1477,6 +1477,7 @@ bgp_get_bucket(struct bgp_channel *c, ea_list *new) /* Create the bucket */ b = mb_alloc(c->pool, size); + *b = (struct bgp_bucket) { }; init_list(&b->prefixes); b->hash = hash; @@ -1601,9 +1602,7 @@ bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id) else px = mb_alloc(c->pool, sizeof(struct bgp_prefix) + net->length); - px->buck_node.next = NULL; - px->buck_node.prev = NULL; - px->next = NULL; + *px = (struct bgp_prefix) { }; px->hash = hash; px->path_id = path_id; net_copy(px->net, net);