]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Zero the newly allocated bucket structure
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 25 Nov 2020 14:44:00 +0000 (15:44 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 25 Nov 2020 14:48:22 +0000 (15:48 +0100)
This fixes an issue with dirty node passed to add_tail().

Thanks to Andreas Rammhold for the initial patch.

proto/bgp/attrs.c

index 828bc118701fd36b759f9f2d03b1db928e3d9bd3..b2c373010d18fc9f543e4f38cd979ca3893f1a63 100644 (file)
@@ -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);