This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/11397] calls to cuserid() can result in buffer overruns and/or overflows
- From: "ldv at altlinux dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 18 Mar 2010 13:21:32 -0000
- Subject: [Bug libc/11397] calls to cuserid() can result in buffer overruns and/or overflows
- References: <20100318032449.11397.jgeisler@cse.taylor.edu>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From ldv at altlinux dot org 2010-03-18 13:21 -------
(In reply to comment #0)
> - return strncpy (s, pwptr->pw_name, L_cuserid);
> + s[L_cuserid - 1] = '\0';
> + return strncpy (s, pwptr->pw_name, L_cuserid - 1);
If any change is going to be made for this case, I suggest this one:
- return strncpy (s, pwptr->pw_name, L_cuserid);
+ s[0] = '\0';
+ return strncat (s, pwptr->pw_name, L_cuserid - 1);
--
http://sourceware.org/bugzilla/show_bug.cgi?id=11397
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.