diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-06 20:23:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-06 20:23:17 +0000 |
commit | 85674180ac0b414993bec634994ea51b28390306 (patch) | |
tree | 5ce384dfed739e368b8605fc6db4ed1f26a43609 /sys/kern/sys_generic.c | |
parent | 44f83f3e77b70fbce9f014e39cf5c97bae700213 (diff) |
back out vfs lite2 till after 2.2
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r-- | sys/kern/sys_generic.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index ab02e3bb9d2..4e9e7c8e10b 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.9 1997/10/06 15:12:28 csapuntz Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.10 1997/10/06 20:20:01 deraadt Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -178,12 +178,18 @@ sys_readv(p, v, retval) goto done; auio.uio_resid = 0; for (i = 0; i < SCARG(uap, iovcnt); i++) { - if (auio.uio_resid + iov->iov_len < auio.uio_resid) { +#if 0 + /* Cannot happen iov_len is unsigned */ + if (iov->iov_len < 0) { error = EINVAL; goto done; } - +#endif auio.uio_resid += iov->iov_len; + if (auio.uio_resid < 0) { + error = EINVAL; + goto done; + } iov++; } #ifdef KTRACE @@ -331,12 +337,18 @@ sys_writev(p, v, retval) goto done; auio.uio_resid = 0; for (i = 0; i < SCARG(uap, iovcnt); i++) { - if (auio.uio_resid + iov->iov_len < auio.uio_resid) { +#if 0 + /* Cannot happen iov_len is unsigned */ + if (iov->iov_len < 0) { error = EINVAL; goto done; } - +#endif auio.uio_resid += iov->iov_len; + if (auio.uio_resid < 0) { + error = EINVAL; + goto done; + } iov++; } #ifdef KTRACE |