]> granicus.if.org Git - sudo/commitdiff
Fix the counting of supplementary groups on AIX.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Mon, 18 Mar 2019 20:08:21 +0000 (14:08 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Mon, 18 Mar 2019 20:08:21 +0000 (14:08 -0600)
We should not assume that basegid will be present in the list of
gids returned by getgrset().

lib/util/getgrouplist.c

index 253736385a9c6a27e70604cbae5a00b413fa77cc..aff795be0ad9a08440d44d8eaf47ba7886d1021c 100644 (file)
@@ -144,6 +144,7 @@ sudo_getgrouplist2_v1(const char *name, GETGROUPS_T basegid,
        /* Dynamically-sized group vector, count groups and alloc. */
        grpsize = 1;    /* reserve one for basegid */
        if (*grset != '\0') {
+           grpsize++;  /* at least one supplementary group */
            for (cp = grset; *cp != '\0'; cp++) {
                if (*cp == ',')
                    grpsize++;