apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Covener <cove...@gmail.com>
Subject Re: apr_env_set use of putenv
Date Fri, 23 Apr 2010 00:47:31 GMT
On Thu, Apr 22, 2010 at 7:30 PM, Wes Garland <wes@page.ca> wrote:
> Leaking is nasty, but I have to agree with Ed here.
> The problem with Graham's "proper" solution is that it is quite legitimate
> for a pure-C caller -- e.g. a DSO with no knowledge of APR whatsoever -- to
> pull an environment variable with getenv and expect to be able to hold on to
> that pointer for the lifetime of the program.

Outside of the issue at hand, It's not safe to hold that getenv()
pointer too long, as any other call to getenv() may change what it
points at.

Eric Covener

View raw message