setenv memory leak fix (take 3)
Andrey Chernov
ache at freebsd.org
Tue May 1 07:39:17 UTC 2007
On Mon, Apr 30, 2007 at 09:04:46PM -0500, Sean C. Farley wrote:
> 2. http://www.farley.org/freebsd/tmp/setenv-8/POSIX/sysenv.c
putenv():
/* Create environment entry. */
envVars[envNdx].name = string;
envVars[envNdx].nameLen = nameLen;
envVars[envNdx].value = equals + 1;
envVars[envNdx].valueSize = valueLen;
It will not work that way. "string" is just passed buffer which can be
altered any time until the next set|putenv call. It means that you can't
assume "nameLen", "equals" position and "valueLen" will stay the same as
at the moment of the call.
--
http://ache.pp.ru/
More information about the freebsd-current
mailing list