From 51bcd15c4853035d1a7d236c096657edb19569dd Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sun, 13 Jan 2013 04:51:29 +0000 Subject: Check results of strdup() of domainname and nameservers options. Original diff from lteo@, tweaked by me. ok lteo@ --- sbin/dhclient/dhclient.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 @@ -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); -- cgit v1.2.3