diff options
Diffstat (limited to 'sys/fs/nfs/nfs_commonsubs.c')
| -rw-r--r-- | sys/fs/nfs/nfs_commonsubs.c | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 8d506a5643a9..f580a394a735 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -194,7 +194,6 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = {  	{ 0, 1, 1, 1, LK_EXCLUSIVE, 1, 1 },		/* Removexattr */  }; -static int ncl_mbuf_mhlen = MHLEN;  struct nfsrv_lughash {  	struct mtx		mtx;  	struct nfsuserhashhead	lughead; @@ -770,7 +769,7 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int how)  		nd->nd_dpos += siz;  	} else if (nd->nd_md->m_next == NULL) {  		return (retp); -	} else if (siz > ncl_mbuf_mhlen) { +	} else if (siz > MHLEN) {  		panic("nfs S too big");  	} else {  		MGET(mp2, how, MT_DATA); @@ -4192,10 +4191,15 @@ nfssvc_idname(struct nfsd_idargs *nidp)  	    nidp->nid_namelen);  	if (error == 0 && nidp->nid_ngroup > 0 &&  	    (nidp->nid_flag & NFSID_ADDUID) != 0) { -		grps = malloc(sizeof(gid_t) * nidp->nid_ngroup, M_TEMP, -		    M_WAITOK); -		error = copyin(nidp->nid_grps, grps, -		    sizeof(gid_t) * nidp->nid_ngroup); +		grps = NULL; +		if (nidp->nid_ngroup > NGROUPS_MAX) +			error = EINVAL; +		if (error == 0) { +			grps = malloc(sizeof(gid_t) * nidp->nid_ngroup, M_TEMP, +			    M_WAITOK); +			error = copyin(nidp->nid_grps, grps, +			    sizeof(gid_t) * nidp->nid_ngroup); +		}  		if (error == 0) {  			/*  			 * Create a credential just like svc_getcred(), | 
