Date: Wed, 17 Jul 2013 12:41:33 +0400 From: Andrey Chernov <ache@freebsd.org> To: Andriy Gapon <avg@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r253380 - head/lib/libc/stdlib Message-ID: <51E658BD.9020700@freebsd.org> In-Reply-To: <51E6576C.6010000@FreeBSD.org> References: <201307160726.r6G7QlwE045679@svn.freebsd.org> <51E61950.5090206@freebsd.org> <51E62219.1090006@freebsd.org> <51E62B37.8080900@freebsd.org> <51E6576C.6010000@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17.07.2013 12:35, Andriy Gapon wrote: >>>>> - env = stpcpy(envVars[envNdx].name, name); >>>>> + env = stpncpy(envVars[envNdx].name, name, nameLen); >>>>> if ((envVars[envNdx].name)[nameLen] != '=') >>>>> env = stpcpy(env, "="); >> Microoptimized: >> >> env = stpncpy(envVars[envNdx].name, name, nameLen); >> *env++ = '='; >> > > In fact, I think that the currently committed code is not functionally broken, > just weird. No. The bad thing is that current code increments "env" pointer unpredictable (depending on junk). And the value of variable is written to that "env" pointer later will be off by one sometimes. -- http://ache.vniz.net/ bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51E658BD.9020700>