Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 May 2007 11:39:05 +0400
From:      Andrey Chernov <ache@freebsd.org>
To:        "Sean C. Farley" <sean-freebsd@farley.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: setenv memory leak fix (take 3)
Message-ID:  <20070501073905.GA4305@nagual.pp.ru>
In-Reply-To: <20070430205747.G28846@thor.farley.org>
References:  <20070426195122.P37719@thor.farley.org> <20070427122634.GA32237@nagual.pp.ru> <20070430205747.G28846@thor.farley.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070501073905.GA4305>