summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 709bcb0..5a5c24c 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -283,7 +283,7 @@ getgroups(struct thread *td, register struct getgroups_args *uap)
u_int ngrp;
int error;
- ngrp = MIN(uap->gidsetsize, NGROUPS);
+ ngrp = MIN(uap->gidsetsize, ngroups_max + 1);
groups = malloc(ngrp * sizeof(*groups), M_TEMP, M_WAITOK);
error = kern_getgroups(td, &ngrp, groups);
if (error)
@@ -796,7 +796,7 @@ setgroups(struct thread *td, struct setgroups_args *uap)
gid_t *groups = NULL;
int error;
- if (uap->gidsetsize > NGROUPS)
+ if (uap->gidsetsize > ngroups_max + 1)
return (EINVAL);
groups = malloc(uap->gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK);
error = copyin(uap->gidset, groups, uap->gidsetsize * sizeof(gid_t));
@@ -815,7 +815,7 @@ kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups)
struct ucred *newcred, *oldcred;
int error;
- if (ngrp > NGROUPS)
+ if (ngrp > ngroups_max + 1)
return (EINVAL);
AUDIT_ARG_GROUPSET(groups, ngrp);
newcred = crget();
@@ -2022,14 +2022,14 @@ crsetgroups_locked(struct ucred *cr, int ngrp, gid_t *groups)
/*
* Copy groups in to a credential after expanding it if required.
- * Truncate the list to NGROUPS if it is too large.
+ * Truncate the list to (ngroups_max + 1) if it is too large.
*/
void
crsetgroups(struct ucred *cr, int ngrp, gid_t *groups)
{
- if (ngrp > NGROUPS)
- ngrp = NGROUPS;
+ if (ngrp > ngroups_max + 1)
+ ngrp = ngroups_max + 1;
crextend(cr, ngrp);
crsetgroups_locked(cr, ngrp, groups);
OpenPOWER on IntegriCloud