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/4528] New: getgrouplist() updates ngroups incorrectly if there was not sufficient room to copy all the supplementary group identifiers


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.


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