diff options
author | 2017-11-14 17:48:48 +0000 | |
---|---|---|
committer | 2017-11-14 17:48:48 +0000 | |
commit | af333735a5126af3057e785b7b6feecc1edb87af (patch) | |
tree | d242f5268ece3491b0a91e3b5e1260b3b97e299a | |
parent | Push the NET_LOCK into ifioctl() and use the NET_RLOCK in ifioctl_get(). (diff) | |
download | wireguard-openbsd-af333735a5126af3057e785b7b6feecc1edb87af.tar.xz wireguard-openbsd-af333735a5126af3057e785b7b6feecc1edb87af.zip |
Treat invalid server name as empty instead of declining the lease offered
by such misconfigured DHCP servers.
Original diff from and ok krw@, ok sthen@
-rw-r--r-- | sbin/dhclient/dhclient.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 9b6aa648bf9..008bcc3ea09 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.522 2017/11/12 11:18:50 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.523 2017/11/14 17:48:48 mpi Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1242,17 +1242,17 @@ packet_to_lease(struct interface_info *ifi, struct option_data *options) if ((lease->options[DHO_DHCP_OPTION_OVERLOAD].len == 0 || (lease->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2) == 0) && packet->sname[0]) { - lease->server_name = malloc(DHCP_SNAME_LEN + 1); + lease->server_name = calloc(1, DHCP_SNAME_LEN + 1); if (lease->server_name == NULL) { log_warn("%s: SNAME", log_procname); goto decline; } memcpy(lease->server_name, packet->sname, DHCP_SNAME_LEN); - lease->server_name[DHCP_SNAME_LEN] = '\0'; if (res_hnok(lease->server_name) == 0) { - log_warnx("%s: invalid host name in SNAME", + log_warnx("%s: invalid host name in SNAME ignored", log_procname); - goto decline; + free(lease->server_name); + lease->server_name = NULL; } } |