fix initgroups (uninitialized count passed to getgrouplist)
authorRich Felker <dalias@aerifal.cx>
Wed, 20 Apr 2011 23:15:27 +0000 (19:15 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 20 Apr 2011 23:15:27 +0000 (19:15 -0400)
src/linux/initgroups.c

index ef9bc10a3a8bb732dfe14dd3415427331032aee8..545d1859734493b92752ec7a49c09e56f9b6f0f5 100644 (file)
@@ -9,7 +9,7 @@ int setgroups(size_t, const gid_t *);
 int initgroups(const char *user, gid_t gid)
 {
        gid_t groups[NGROUPS_MAX];
-       int count;
+       int count = NGROUPS_MAX;
        if (getgrouplist(user, gid, groups, &count) < 0) return -1;
        return setgroups(count, groups);
 }