From: Ondrej Zajicek (work) Date: Tue, 24 Nov 2020 02:42:23 +0000 (+0100) Subject: Fix some failed asserts due to add_tail() X-Git-Tag: v2.0.8~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1678bc07467e6d977fc2f6bf830274ca92e0a6e5;p=thirdparty%2Fbird.git Fix some failed asserts due to add_tail() When config structures are copied due to template application, we need to reset list node structure before calling add_tail(). Thanks to Mikael Magnusson for patches. --- diff --git a/conf/conf.c b/conf/conf.c index b21d5213a..6f64b5416 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -573,6 +573,7 @@ cfg_copy_list(list *dest, list *src, unsigned node_size) { dn = cfg_alloc(node_size); memcpy(dn, sn, node_size); + memset(dn, 0, sizeof(node)); add_tail(dest, dn); } } diff --git a/nest/proto.c b/nest/proto.c index 41b3a6b9c..748601c36 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -626,6 +626,7 @@ channel_copy_config(struct channel_config *src, struct proto_config *proto) struct channel_config *dst = cfg_alloc(src->channel->config_size); memcpy(dst, src, src->channel->config_size); + memset(&dst->n, 0, sizeof(node)); add_tail(&proto->channels, &dst->n); CALL(src->channel->copy_config, dst, src); diff --git a/proto/static/static.c b/proto/static/static.c index 7b22d49b3..941e916f8 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -643,6 +643,7 @@ static_copy_config(struct proto_config *dest, struct proto_config *src) { dnh = cfg_alloc(sizeof(struct static_route)); memcpy(dnh, snh, sizeof(struct static_route)); + memset(&dnh->n, 0, sizeof(node)); if (!drt) add_tail(&d->routes, &(dnh->n));