Module Name: src Committed By: christos Date: Mon Mar 7 12:48:53 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.9 -r1.10 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.9 src/sbin/ifconfig/env.c:1.10 --- src/sbin/ifconfig/env.c:1.9 Thu Feb 7 08:20:51 2013 +++ src/sbin/ifconfig/env.c Mon Mar 7 07:48:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: env.c,v 1.9 2013/02/07 13:20:51 apb Exp $ */ +/* $NetBSD: env.c,v 1.10 2016/03/07 12:48:53 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.9 2013/02/07 13:20:51 apb Exp $"); +__RCSID("$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $"); #endif /* not lint */ #include <errno.h> @@ -162,8 +162,8 @@ getargstr(prop_dictionary_t env, const c errno = ENAMETOOLONG; return -1; } - memset(buf, 0, buflen); memcpy(buf, prop_data_data_nocopy(data), datalen); + memset(buf + datalen, 0, buflen - datalen); return datalen; }