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

Andriy Gapon avg at FreeBSD.org
Wed Jul 17 08:44:34 UTC 2013


on 17/07/2013 11:41 Andrey Chernov said the following:
> 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.
> 

Ah, true.

-- 
Andriy Gapon


More information about the svn-src-all mailing list