[patch]: Uninitialized list nodes
Hi, I have found two occurrences of uninitialized list nodes in bird's master branch. The following config causes asserts (when built with debugging). # Router ID in IPv4 format router id 62.168.0.1; protocol device { interface "*"; } # Static route feed template static t1 { ipv4 { export all; }; route 10.0.0.0/24 unreachable; } protocol static from t1 { } The attached patches solves the problems. /Mikael
On Wed, Sep 09, 2020 at 12:42:24AM +0200, Mikael wrote:
Hi,
I have found two occurrences of uninitialized list nodes in bird's master branch.
The following config causes asserts (when built with debugging).
Hi Thanks, merged.
# Router ID in IPv4 format router id 62.168.0.1;
protocol device { interface "*"; }
# Static route feed template static t1 { ipv4 { export all; }; route 10.0.0.0/24 unreachable; }
protocol static from t1 { }
The attached patches solves the problems.
/Mikael
From 55fed9438e24303de1633472a2a03015106d8914 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson <mikma@users.sourceforge.net> Date: Wed, 13 May 2020 19:06:50 +0200 Subject: [PATCH 1/2] Nest: Fix assert failed in channel_copy_config
Initializing n in the copy of the channel config fixes: assertion 'n->prev == ((void *)0)' failed at ../lib/lists.c:79 --- nest/proto.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/nest/proto.c b/nest/proto.c index 41b3a6b9..b7a5c673 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(struct node)); add_tail(&proto->channels, &dst->n); CALL(src->channel->copy_config, dst, src);
-- 2.25.1
From ed0d3126bbd58ebb5ea0d11d9746f3ff817d16f6 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson <mikma@users.sourceforge.net> Date: Wed, 9 Sep 2020 00:28:03 +0200 Subject: [PATCH 2/2] Nest: Fix assert failed in static_copy_config
Initializing n in the copy of the static route fixes: assertion 'n->prev == ((void *)0)' failed at ../lib/lists.c:79 --- proto/static/static.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/proto/static/static.c b/proto/static/static.c index 72b14991..06e9fb47 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -589,6 +589,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(struct node));
if (!drt) add_tail(&d->routes, &(dnh->n)); -- 2.25.1
-- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Mikael -
Ondrej Zajicek