summaryrefslogtreecommitdiff
path: root/sys/miscfs/fdesc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/miscfs/fdesc')
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index 6c57364e670..44ef2f4f419 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.13 1999/04/28 09:28:15 art Exp $ */
+/* $OpenBSD: fdesc_vnops.c,v 1.14 1999/08/13 04:50:46 deraadt Exp $ */
/* $NetBSD: fdesc_vnops.c,v 1.32 1996/04/11 11:24:29 mrg Exp $ */
/*
@@ -716,9 +716,7 @@ fdesc_readdir(v)
fdp = uio->uio_procp->p_fd;
- if (uio->uio_resid < UIO_MX)
- return (EINVAL);
- if (uio->uio_offset < 0)
+ if (uio->uio_offset < 0 || uio->uio_offset % UIO_MX)
return (EINVAL);
error = 0;
@@ -729,6 +727,9 @@ fdesc_readdir(v)
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) {