check bounds properly.
This commit is contained in:
parent
b94d5a36e7
commit
2c979dcde5
|
@ -72,12 +72,12 @@ getgrouplist(uname, agroup, groups, grpcnt)
|
||||||
while (grp = getgrent()) {
|
while (grp = getgrent()) {
|
||||||
if (grp->gr_gid == agroup)
|
if (grp->gr_gid == agroup)
|
||||||
continue;
|
continue;
|
||||||
if (ngroups >= maxgroups) {
|
|
||||||
ret = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (i = 0; grp->gr_mem[i]; i++) {
|
for (i = 0; grp->gr_mem[i]; i++) {
|
||||||
if (!strcmp(grp->gr_mem[i], uname)) {
|
if (!strcmp(grp->gr_mem[i], uname)) {
|
||||||
|
if (ngroups >= maxgroups) {
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
groups[ngroups++] = grp->gr_gid;
|
groups[ngroups++] = grp->gr_gid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue