diff options
author | 1999-08-13 07:05:46 +0000 | |
---|---|---|
committer | 1999-08-13 07:05:46 +0000 | |
commit | bf79602a177b18cc207279fb2f83a936ddf11697 (patch) | |
tree | 2c2dcfb314f81435fe36ff94aa4d0e44fe5694a9 | |
parent | More USB manpages. (diff) | |
download | wireguard-openbsd-bf79602a177b18cc207279fb2f83a936ddf11697.tar.xz wireguard-openbsd-bf79602a177b18cc207279fb2f83a936ddf11697.zip |
Better fix for fdesc/procfs panic.
-rw-r--r-- | sys/miscfs/fdesc/fdesc_vnops.c | 9 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vnops.c | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c index 44ef2f4f419..9c5652dbd09 100644 --- a/sys/miscfs/fdesc/fdesc_vnops.c +++ b/sys/miscfs/fdesc/fdesc_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdesc_vnops.c,v 1.14 1999/08/13 04:50:46 deraadt Exp $ */ +/* $OpenBSD: fdesc_vnops.c,v 1.15 1999/08/13 07:05:46 csapuntz Exp $ */ /* $NetBSD: fdesc_vnops.c,v 1.32 1996/04/11 11:24:29 mrg Exp $ */ /* @@ -716,20 +716,19 @@ fdesc_readdir(v) fdp = uio->uio_procp->p_fd; - if (uio->uio_offset < 0 || uio->uio_offset % UIO_MX) + if (uio->uio_resid < UIO_MX) return (EINVAL); error = 0; i = uio->uio_offset; + if (i < 0) + return (EINVAL); bzero((caddr_t)&d, UIO_MX); d.d_reclen = UIO_MX; if (VTOFDESC(ap->a_vp)->fd_type == Froot) { struct fdesc_target *ft; - if (nfdesc_targets <= uio->uio_offset/UIO_MX) - return (EINVAL); - for (ft = &fdesc_targets[i]; uio->uio_resid >= UIO_MX && i < nfdesc_targets; ft++, i++) { switch (ft->ft_fileno) { diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index d413736c616..3472f7c6437 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.13 1999/08/13 04:50:48 deraadt Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.14 1999/08/13 07:05:46 csapuntz Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -823,11 +823,13 @@ procfs_readdir(v) pfs = VTOPFS(ap->a_vp); - if (uio->uio_offset < 0 || uio->uio_offset % UIO_MX) + if (uio->uio_resid < UIO_MX) return (EINVAL); error = 0; i = uio->uio_offset; + if (i < 0) + return (EINVAL); bzero((caddr_t)&d, UIO_MX); d.d_reclen = UIO_MX; @@ -841,9 +843,6 @@ procfs_readdir(v) struct proc *p; struct proc_target *pt; - if (nproc_targets <= uio->uio_offset/UIO_MX) - return (EINVAL); - p = PFIND(pfs->pfs_pid); if (p == NULL) break; |