[Bug libc/13983] __libc_message() shouldn't blindly write to STDERR_FILENO

polacek at redhat dot com sourceware-bugzilla@sourceware.org
Sun Apr 15 23:18:00 GMT 2012


http://sourceware.org/bugzilla/show_bug.cgi?id=13983

Marek Polacek <polacek at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |polacek at redhat dot com

--- Comment #1 from Marek Polacek <polacek at redhat dot com> 2012-04-15 23:18:13 UTC ---
E.g. here:

$ cat x.c
#include <stdio.h>
#include <string.h>

int
main (void)
{
  fclose (stderr);
  char a[5] = { };
  strcpy (a, "foobarbaz");
}
$ gcc -O2 -D_FORTIFY_SOURCE=2 x.c
$ LIBC_FATAL_STDERR_=1 ./testrun.sh ./a.out
Aborted

we use stderr stream after it's been closed, which is undefined; it looks like
we really should check STDERR_FILENO before writing to it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list