From: deraadt Date: Sat, 17 Jan 2015 17:49:26 +0000 (+0000) Subject: use NGROUPS_MAX X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=646fde30d6f430d60b0ffc4daca4ae3877937412;p=openbsd use NGROUPS_MAX --- diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index a08790d5f2d..61cdb9bcc09 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.61 2014/09/17 19:26:06 millert Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.62 2015/01/17 17:49:26 deraadt Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -860,14 +860,14 @@ sys_setgroups(struct proc *p, void *v, register_t *retval) } */ *uap = v; struct process *pr = p->p_p; struct ucred *pruc, *newcred; - gid_t groups[NGROUPS]; + gid_t groups[NGROUPS_MAX]; u_int ngrp; int error; if ((error = suser(p, 0)) != 0) return (error); ngrp = SCARG(uap, gidsetsize); - if (ngrp > NGROUPS) + if (ngrp > NGROUPS_MAX) return (EINVAL); error = copyin(SCARG(uap, gidset), groups, ngrp * sizeof(gid_t)); if (error == 0) { diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index c17ac3d9e29..b412cb47eb9 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.106 2014/11/14 23:01:44 tedu Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.107 2015/01/17 17:49:27 deraadt Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -1514,11 +1514,11 @@ nfs_getreq(struct nfsrv_descript *nd, struct nfsd *nfsd, int has_header) } nfsm_dissect(tl, u_int32_t *, (len + 2) * NFSX_UNSIGNED); for (i = 0; i < len; i++) - if (i < NGROUPS) + if (i < NGROUPS_MAX) nd->nd_cr.cr_groups[i] = fxdr_unsigned(gid_t, *tl++); else tl++; - nd->nd_cr.cr_ngroups = (len > NGROUPS) ? NGROUPS : len; + nd->nd_cr.cr_ngroups = (len > NGROUPS_MAX) ? NGROUPS_MAX : len; len = fxdr_unsigned(int, *++tl); if (len < 0 || len > RPCAUTH_MAXSIZ) { m_freem(info.nmi_mrep); diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 183bfc83bbf..ddcd98b253e 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.123 2014/12/29 05:29:28 miod Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.124 2015/01/17 17:49:27 deraadt Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1462,7 +1462,7 @@ nfsrv_fhtovp(fhandle_t *fhp, int lockflag, struct vnode **vpp, if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) { cred->cr_uid = credanon->cr_uid; cred->cr_gid = credanon->cr_gid; - for (i = 0; i < credanon->cr_ngroups && i < NGROUPS; i++) + for (i = 0; i < credanon->cr_ngroups && i < NGROUPS_MAX; i++) cred->cr_groups[i] = credanon->cr_groups[i]; cred->cr_ngroups = i; } diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 2bad0a91bdd..de00884ec92 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.105 2014/12/18 20:59:21 tedu Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.106 2015/01/17 17:49:27 deraadt Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -292,8 +292,8 @@ nfs_mountroot(void) proc0.p_ucred->cr_uid = ntohl(nfs_diskless.swap_ucred.cr_uid); proc0.p_ucred->cr_gid = ntohl(nfs_diskless.swap_ucred.cr_gid); if ((proc0.p_ucred->cr_ngroups = ntohs(nfs_diskless.swap_ucred.cr_ngroups)) > - NGROUPS) - proc0.p_ucred->cr_ngroups = NGROUPS; + NGROUPS_MAX) + proc0.p_ucred->cr_ngroups = NGROUPS_MAX; for (i = 0; i < proc0.p_ucred->cr_ngroups; i++) proc0.p_ucred->cr_groups[i] = ntohl(nfs_diskless.swap_ucred.cr_groups[i]); #endif