2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-30 05:48:18 +00:00

Pass getgrouplist() NGROUPS_MAX+1, not NGROUPS_MAX so we have room

for the primary gid.
This commit is contained in:
Todd C. Miller 2018-09-22 12:55:44 -06:00
parent 72ce2c807b
commit d8870177c2

View File

@ -84,6 +84,7 @@ sudo_getgrouplist2_v1(const char *name, GETGROUPS_T basegid,
grpsize = (int)sysconf(_SC_NGROUPS_MAX);
if (grpsize < 0)
grpsize = NGROUPS_MAX;
grpsize++; /* include space for the primary gid */
/*
* It is possible to belong to more groups in the group database
* than NGROUPS_MAX.