From: Todd C. Miller Date: Sat, 22 Sep 2018 18:55:44 +0000 (-0600) Subject: Pass getgrouplist() NGROUPS_MAX+1, not NGROUPS_MAX so we have room X-Git-Tag: SUDO_1_8_26^2~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8870177c2f516a48c832e9ef90c4d90cba0a63d;p=sudo Pass getgrouplist() NGROUPS_MAX+1, not NGROUPS_MAX so we have room for the primary gid. --- diff --git a/lib/util/getgrouplist.c b/lib/util/getgrouplist.c index 4d47ade82..b791d260e 100644 --- a/lib/util/getgrouplist.c +++ b/lib/util/getgrouplist.c @@ -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.