Module Name:    src
Committed By:   christos
Date:           Mon Mar  7 15:56:17 UTC 2016

Modified Files:
        src/sbin/ifconfig: env.c

Log Message:
PR/50909: David Binderman: Optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/ifconfig/env.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/ifconfig/env.c
diff -u src/sbin/ifconfig/env.c:1.10 src/sbin/ifconfig/env.c:1.11
--- src/sbin/ifconfig/env.c:1.10	Mon Mar  7 07:48:53 2016
+++ src/sbin/ifconfig/env.c	Mon Mar  7 10:56:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $	*/
+/*	$NetBSD: env.c,v 1.11 2016/03/07 15:56:17 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Young.  All rights reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $");
+__RCSID("$NetBSD: env.c,v 1.11 2016/03/07 15:56:17 christos Exp $");
 #endif /* not lint */
 
 #include <errno.h>
@@ -141,8 +141,8 @@ getargdata(prop_dictionary_t env, const 
 		errno = ENAMETOOLONG; 
 		return -1;
 	}
-	memset(buf, 0, buflen);
 	memcpy(buf, prop_data_data_nocopy(data), datalen);
+	memset(buf + datalen, 0, buflen - datalen);
 	return datalen;
 }
 

Reply via email to