This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/13231] setenv ("NAME", NULL) corrupts environment
- From: "robert.ancell at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Sun, 16 Oct 2011 22:04:08 +0000
- Subject: [Bug libc/13231] setenv ("NAME", NULL) corrupts environment
- Auto-submitted: auto-generated
- References: <bug-13231-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=13231
--- Comment #2 from Robert Ancell <robert.ancell at gmail dot com> 2011-10-16 22:04:08 UTC ---
Could you please consider changing this line then:
const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
to:
const size_t vallen = strlen (value) + 1;
This is detecting that value is NULL, handling it, then causing a greater
problem later on in the function. If value must be non NULL then a
segmentation fault is preferable to a memory corruption which is much harded to
diagnose.
--
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.