+2010-03-24 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #11397]
+ * sysdeps/posix/cuserid.c (cuserid): Make sure the returned string
+ is NUL terminated.
+ Patch by Jonathan Geisler <jgeisler@cse.taylor.edu>.
+
2010-03-02 Richard Guenther <rguenther@suse.de>
* sysdeps/x86_64/dl-machine.h (elf_machine_rela): R_X86_64_PC32
-/* Copyright (C) 1991, 1996, 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1998, 1999, 2001, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (s == NULL)
s = name;
- return strncpy (s, pwptr->pw_name, L_cuserid);
+ s[L_userid - 1] = '\0';
+ return strncpy (s, pwptr->pw_name, L_cuserid - 1);
}