diff options
author | 2019-03-31 17:02:47 +0000 | |
---|---|---|
committer | 2019-03-31 17:02:47 +0000 | |
commit | 172e96733a5cf884ff234c865a77c75f7fbff299 (patch) | |
tree | 128743798a13d52dd9b995674af461fd6087152b | |
parent | Move the struct peer into bgpd_config and switch it to a TAILQ instead of (diff) | |
download | wireguard-openbsd-172e96733a5cf884ff234c865a77c75f7fbff299.tar.xz wireguard-openbsd-172e96733a5cf884ff234c865a77c75f7fbff299.zip |
Don't use memcpy for struct bgpd_config, the pointers and lists in that
struct will most probably be wrong. Instead merge the sets and roa table
over by hand so that we know the data is correct and valid.
OK denis@ deraadt@
-rw-r--r-- | usr.sbin/bgpd/rde.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 69d8fcdf60d..28ab4906a89 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.467 2019/03/23 13:09:56 denis Exp $ */ +/* $OpenBSD: rde.c,v 1.468 2019/03/31 17:02:47 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2899,11 +2899,15 @@ rde_reload_done(void) roa_old = conf->rde_roa; as_sets_old = conf->as_sets; - memcpy(conf, nconf, sizeof(struct bgpd_config)); - SIMPLEQ_INIT(&conf->rde_prefixsets); - SIMPLEQ_INIT(&conf->rde_originsets); + copy_config(conf, nconf); + /* need to copy the sets and roa table and clear them in nconf */ SIMPLEQ_CONCAT(&conf->rde_prefixsets, &nconf->rde_prefixsets); SIMPLEQ_CONCAT(&conf->rde_originsets, &nconf->rde_originsets); + conf->rde_roa = nconf->rde_roa; + conf->as_sets = nconf->as_sets; + memset(&nconf->rde_roa, 0, sizeof(nconf->rde_roa)); + nconf->as_sets = NULL; + free_config(nconf); nconf = NULL; |