linux: setgroups(): Fix the group number's upper limit
'ngroups_max' is the maximum number of supplementary groups the system
will accept, and this has not changed.
Fixes: 9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after: 5 days
MFC to: stable/15
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52277
This commit is contained in:
@@ -1034,7 +1034,7 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
|
||||
int error;
|
||||
struct proc *p;
|
||||
|
||||
if (ngrp < 0 || ngrp >= ngroups_max)
|
||||
if (ngrp < 0 || ngrp > ngroups_max)
|
||||
return (EINVAL);
|
||||
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
|
||||
error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
|
||||
|
||||
@@ -91,7 +91,7 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
|
||||
int error;
|
||||
struct proc *p;
|
||||
|
||||
if (ngrp < 0 || ngrp >= ngroups_max)
|
||||
if (ngrp < 0 || ngrp > ngroups_max)
|
||||
return (EINVAL);
|
||||
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
|
||||
error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
|
||||
|
||||
Reference in New Issue
Block a user