diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-27 11:09:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-27 11:09:40 +0000 |
commit | d0a38c6c701db6a215b70fb2f3031c58067c4f2b (patch) | |
tree | 57fa273ea3ec279a2024d413e46b2a3e6787ba41 /sys/nfs/nfs_subs.c | |
parent | 7718e0220a2559fc77e76baa1b8b583af64bde74 (diff) |
fvdl; We're only handling uio with iovcnt == 1, so don't ever attempt to
increment uio_iov, this will get us into nasty trouble. (Thanks to
Matthias Drochner for tracking this down).
Diffstat (limited to 'sys/nfs/nfs_subs.c')
-rw-r--r-- | sys/nfs/nfs_subs.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index d941d979e6d..5b7414c5c65 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,5 +1,5 @@ -/* $OpenBSD: nfs_subs.c,v 1.9 1996/07/23 21:32:31 deraadt Exp $ */ -/* $NetBSD: nfs_subs.c,v 1.27.4.1 1996/05/25 22:40:34 fvdl Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.10 1996/07/27 11:09:39 deraadt Exp $ */ +/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* * Copyright (c) 1989, 1993 @@ -612,7 +612,7 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len, struct mbuf *mreq, *mb2; int siz, grpsiz, authsiz; struct timeval tv; - static u_long base; + static u_int32_t base; authsiz = nfsm_rndup(auth_len); MGETHDR(mb, M_WAIT, MT_DATA); @@ -826,7 +826,8 @@ nfsm_mbuftouio(mrep, uiop, siz, dpos) } /* - * copies a uio scatter/gather list to an mbuf chain... + * copies a uio scatter/gather list to an mbuf chain. + * NOTE: can ony handle iovcnt == 1 */ int nfsm_uiotombuf(uiop, mq, siz, bpos) @@ -841,6 +842,11 @@ nfsm_uiotombuf(uiop, mq, siz, bpos) int uiosiz, clflg, rem; char *cp; +#ifdef DIAGNOSTIC + if (uiop->uio_iovcnt != 1) + panic("nfsm_uiotombuf: iovcnt != 1"); +#endif + if (siz > MLEN) /* or should it >= MCLBYTES ?? */ clflg = 1; else @@ -848,8 +854,6 @@ nfsm_uiotombuf(uiop, mq, siz, bpos) rem = nfsm_rndup(siz)-siz; mp = mp2 = *mq; while (siz > 0) { - if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) - return (EINVAL); left = uiop->uio_iov->iov_len; uiocp = uiop->uio_iov->iov_base; if (left > siz) @@ -884,13 +888,8 @@ nfsm_uiotombuf(uiop, mq, siz, bpos) uiop->uio_offset += xfer; uiop->uio_resid -= xfer; } - if (uiop->uio_iov->iov_len <= siz) { - uiop->uio_iovcnt--; - uiop->uio_iov++; - } else { - uiop->uio_iov->iov_base += uiosiz; - uiop->uio_iov->iov_len -= uiosiz; - } + uiop->uio_iov->iov_base += uiosiz; + uiop->uio_iov->iov_len -= uiosiz; siz -= uiosiz; } if (rem > 0) { |