This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13231] setenv ("NAME", NULL) corrupts environment


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]