svn commit: r253380 - head/lib/libc/stdlib

Andrey Chernov ache at freebsd.org
Wed Jul 17 08:41:45 UTC 2013


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


More information about the svn-src-all mailing list