This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/1970] New: getgrnam_r() and groups with more than 1024 bytes
- From: "burnus at gmx dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 2 Dec 2005 17:21:21 -0000
- Subject: [Bug libc/1970] New: getgrnam_r() and groups with more than 1024 bytes
- Reply-to: sourceware-bugzilla at sourceware dot org
If I have a group with many entries (`/usr/bin/getent group test |wc -c
` > 1024), getgrnam() duely returns the entry whereas getgrnam_r() has some
troubles.
a) sysconf(_SC_GETGR_R_SIZE_MAX);
returns always 1024, which is not large enough, but as there is ENORANGE, it is
not too bad.
SUSv3: "_SC_GETGR_R_SIZE_MAX Maximum size of getgrgid_r() and getgrnam_r() data
buffers" and "The maximum size needed for this buffer [3rd argument of
getgrnam_r] can be determined with the {_SC_GETGR_R_SIZE_MAX} sysconf() parameter."
b) Using getgrnam_r() with a big group and a too small buffer =
_SC_GETGR_R_SIZE_MAX == 1024:
(i) group: files (in /etc/nsswitch.conf)
returned value: ERANGE, which is ok
(ii) group: compat (in /etc/nsswitch.conf)
getgrnam_r crashes with a memory access error.
Expected: ERANGE or e.g. EIO.
c) Using getgrnam_r() with a buffer bigger than 1024
(i) entry < 1024: Ok
(ii) entry > 1024 (independent of group:files vs. group:compat)
Memory access error
--
Summary: getgrnam_r() and groups with more than 1024 bytes
Product: glibc
Version: 2.3.5
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: burnus at gmx dot de
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: Compiled on a Linux 2.6.12 system on 2005-09-09.
GCC host triplet: SUSE Linux 10.0 (i386) with kernel 2.6.14-
20051028140608-default
GCC target triplet: Configured for i686-suse-linux.
http://sourceware.org/bugzilla/show_bug.cgi?id=1970
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.