This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/4528] New: getgrouplist() updates ngroups incorrectly if there was not sufficient room to copy all the supplementary group identifiers
- From: "lex at ispras dot ru" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 21 May 2007 14:10:46 -0000
- Subject: [Bug libc/4528] New: getgrouplist() updates ngroups incorrectly if there was not sufficient room to copy all the supplementary group identifiers
- Reply-to: sourceware-bugzilla at sourceware dot org
According to LSB 3.1 standard if there was not sufficient room to copy all the
supplementary group identifiers, getgrouplist() shall return -1, and update
the value referenced by ngroups to the number actually copied.
But on Red Hat 4 user 'root' is a member of 8 groups and if the supplied array
has size 2, then -1 will be returned and ngroups will be set to 8.
The following code shows it.
#include <stdio.h>
#include <grp.h>
#include <sys/types.h>
int main(int argc, char* argv[])
{
gid_t groups[2];
int ngroups=2;
int res;
res=getgrouplist("root", 1000, groups, &ngroups);
printf("res=%d\n", res);
printf("ngroups=%d\n", ngroups);
return 0;
}
--
Summary: getgrouplist() updates ngroups incorrectly if there was
not sufficient room to copy all the supplementary group
identifiers
Product: glibc
Version: 2.4
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: lex at ispras dot ru
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=4528
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.