From 91c812dd6424ec7e01de4092fe6da236c36f6069 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Thu, 2 Aug 2012 11:46:36 +0200 Subject: [PATCH] dhclient - Use strdup() instead of malloc/strlcpy. Taken-from: OpenBSD --- sbin/dhclient/parse.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c index 1e00765528..138518b452 100644 --- a/sbin/dhclient/parse.c +++ b/sbin/dhclient/parse.c @@ -1,5 +1,4 @@ -/* $OpenBSD: parse.c,v 1.18 2007/01/08 13:34:38 krw Exp $ */ -/* $DragonFly: src/sbin/dhclient/parse.c,v 1.1 2008/08/30 16:07:58 hasso Exp $ */ +/* $OpenBSD: src/sbin/dhclient/parse.c,v 1.19 2010/06/26 21:14:10 krw Exp $ */ /* Common parser code for dhcpd and dhclient. */ @@ -124,10 +123,9 @@ parse_string(FILE *cfile) skip_to_semi(cfile); return (NULL); } - s = malloc(strlen(val) + 1); + s = strdup(val); if (!s) error("no memory for string %s.", val); - strlcpy(s, val, strlen(val) + 1); if (!parse_semi(cfile)) { free(s); -- 2.41.0