mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-20 02:01:19 +01:00
Protect against duplicate gids in group list (as could be the
result of being a member of some group in both /etc/group and YP).
This commit is contained in:
parent
a1c128ae2a
commit
f067e922a9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6530
@ -70,8 +70,10 @@ getgrouplist(uname, agroup, groups, grpcnt)
|
||||
*/
|
||||
setgrent();
|
||||
while (grp = getgrent()) {
|
||||
if (grp->gr_gid == agroup)
|
||||
continue;
|
||||
for (i = 1; i < ngroups; i++) {
|
||||
if (grp->gr_gid == groups[i])
|
||||
goto skip;
|
||||
}
|
||||
if (ngroups >= maxgroups) {
|
||||
ret = -1;
|
||||
break;
|
||||
@ -82,6 +84,7 @@ getgrouplist(uname, agroup, groups, grpcnt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
skip:
|
||||
}
|
||||
endgrent();
|
||||
*grpcnt = ngroups;
|
||||
|
Loading…
Reference in New Issue
Block a user