From 0f5967764a534f649b5ec55d935b037f319ce624 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 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c index 1e00765..138518b 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); -- 1.7.7.2