[patch] Error on setenv(..., NULL, ...)
Paul Pluzhnikov
ppluzhnikov@google.com
Sun Mar 15 23:33:00 GMT 2015
On Sun, Mar 15, 2015 at 3:57 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> Hmm, I also get the same warning using quite recent trunk GCC build (@r221169).
I temporarily fixed the warning with:
@@ -121,7 +121,7 @@ __add_to_environ (name, value, combined, replace)
causes setenv (..., NULL, ...) to dump core now instead of
corrupting memory later. */
const size_t namelen = strlen (name);
- size_t vallen;
+ size_t vallen = 0;
if (combined != NULL)
vallen = strlen (value) + 1;
"make check" then fails a lot of tests, including stdlib/tst-environ,
which fails like so:
getenv #2 failed
getenv #3 failed
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 movdqu (%rax), %xmm12
(gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00007ffff7c924de in __add_to_environ (name=0x7fffffffe630
"FOOBAR", value=value@entry=0x0, combined=combined@entry=0x6031a0
"FOOBAR=some longer value", replace=replace@entry=1) at setenv.c:126
#2 0x00007ffff7c9242d in putenv (string=0x6031a0 "FOOBAR=some longer
value") at putenv.c:78
So it looks to me like the 2ecccaede9097f867284d352a881d8f226ba4fb7 is
quite broken, and should be reverted.
--
Paul Pluzhnikov
More information about the Libc-alpha
mailing list