check bounds properly.

This commit is contained in:
cgd 1994-10-13 19:47:10 +00:00
parent b94d5a36e7
commit 2c979dcde5
1 changed files with 4 additions and 4 deletions

View File

@ -72,12 +72,12 @@ getgrouplist(uname, agroup, groups, grpcnt)
while (grp = getgrent()) {
if (grp->gr_gid == agroup)
continue;
if (ngroups >= maxgroups) {
ret = -1;
break;
}
for (i = 0; grp->gr_mem[i]; i++) {
if (!strcmp(grp->gr_mem[i], uname)) {
if (ngroups >= maxgroups) {
ret = -1;
break;
}
groups[ngroups++] = grp->gr_gid;
break;
}