Hi,

On Sat, Feb 02, 2013 at 03:36:37PM +0100, Arne Schwabe wrote:
> The construct_name_value eventually call gc_malloc with NULL as gc which will 
> trigger an assertion
[..]
> -      char *str = construct_name_value (name_tmp, val_tmp, NULL);
> +      char *str = construct_name_value (name_tmp, val_tmp, &gc);
>        if (platform_putenv(str))
>        {
>          msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);

NAK!

platform_putenv() calls putenv() on non-windows platforms, and that one
will just add a pointer to the string passed to it to envp[] (at least
that's how I read the manpage: "The string pointed to by string becomes 
part of the environment, so altering the string changes the environment").

So your environment now points to a garbage buffer, which is then 
destroyed again.

I think there needs to be a strdup() here...

(And I seem to remember that "some of the buffer functions" did exactly
this when &gc was NULL, but maybe we threw this out last year... David?)

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: pgpmOFYQwrTrw.pgp
Description: PGP signature

Reply via email to