diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-01-13 04:51:29 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-01-13 04:51:29 +0000 |
commit | 51bcd15c4853035d1a7d236c096657edb19569dd (patch) | |
tree | 83f4f00ba529a3f15ed815bf410434490b1fe6aa | |
parent | f310d1932acf34b4ace370663ae4386f330e56a6 (diff) |
Check results of strdup() of domainname and nameservers options.
Original diff from lteo@, tweaked by me. ok lteo@
-rw-r--r-- | sbin/dhclient/dhclient.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 4b553293bce..41ffd12055c 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.202 2013/01/06 15:33:12 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.203 2013/01/13 04:51:28 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -718,12 +718,17 @@ bind_lease(void) DHO_DOMAIN_NAME, &options[DHO_DOMAIN_NAME], 0)); else domainname = strdup(""); + if (domainname == NULL) + error("no memory for domainname"); + if (options[DHO_DOMAIN_NAME_SERVERS].len) { nameservers = strdup(pretty_print_option( DHO_DOMAIN_NAME_SERVERS, &options[DHO_DOMAIN_NAME_SERVERS], 0)); } else nameservers = strdup(""); + if (nameservers == NULL) + error("no memory for nameservers"); new_resolv_conf(ifi->name, domainname, nameservers); |