diff options
author | 2014-11-20 19:27:28 +0000 | |
---|---|---|
committer | 2014-11-20 19:27:28 +0000 | |
commit | 4bb6fc65b7128ddf2ddeaf4a1bf9267a226325cd (patch) | |
tree | c402cb590f1064bf8518e77a59e3beda856714fe | |
parent | Oops, make sure camellia is compiled on platforms without an arch-specific (diff) | |
download | wireguard-openbsd-4bb6fc65b7128ddf2ddeaf4a1bf9267a226325cd.tar.xz wireguard-openbsd-4bb6fc65b7128ddf2ddeaf4a1bf9267a226325cd.zip |
A little too agressive reordering. Must initialize the client struct
before filling it in with read_client_conf(). Fixes seg fault when
lease {} statement is used.
Problem reported by Alessandro de Laurenzis via misc@. Thanks!
-rw-r--r-- | sbin/dhclient/dhclient.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index ee8a46d7f33..03d1bb20c73 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.332 2014/11/17 16:18:20 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.333 2014/11/20 19:27:28 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -488,6 +488,12 @@ main(int argc, char *argv[]) error("config calloc"); TAILQ_INIT(&config->reject_list); + client = calloc(1, sizeof(*client)); + if (client == NULL) + error("client calloc"); + TAILQ_INIT(&client->leases); + TAILQ_INIT(&client->offered_leases); + read_client_conf(); /* Needed for config->link_timeout below! */ if (interface_status(ifi->name) == 0) { @@ -530,12 +536,6 @@ main(int argc, char *argv[]) _PATH_DHCLIENT_DB, ifi->name) == -1) error("asprintf"); - client = calloc(1, sizeof(*client)); - if (client == NULL) - error("client calloc"); - TAILQ_INIT(&client->leases); - TAILQ_INIT(&client->offered_leases); - /* 2nd stage (post fork) config setup. */ if (ignore_list) apply_ignore_list(ignore_list); |