aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
authorIan Dowse <iedowse@FreeBSD.org>2001-08-10 22:14:18 +0000
committerIan Dowse <iedowse@FreeBSD.org>2001-08-10 22:14:18 +0000
commita9a8ba3d71317f7b24ad9e1ab0b23239e1057669 (patch)
treed5f2f288f3f2ffff27a1098615cf2ec1edba15a5 /sys/kern/vfs_extattr.c
parentf34a9421b1b8a38c5767ee013641b2ea4581ddc6 (diff)
downloadsrc-a9a8ba3d71317f7b24ad9e1ab0b23239e1057669.tar.gz
src-a9a8ba3d71317f7b24ad9e1ab0b23239e1057669.zip
Arbitrarily limit to 64k the number of bytes that can be read at
a time using the ogetdirentries() compatibility syscall. This is a hack to ensure that rediculous values don't get passed to MALLOC(). Reviewed by: kris
Notes
Notes: svn path=/head/; revision=81487
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 35f9576c42ec..187727f87b97 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -3059,6 +3059,9 @@ ogetdirentries(p, uap)
int error, eofflag, readcnt;
long loff;
+ /* XXX arbitrary sanity limit on `count'. */
+ if (SCARG(uap, count) > 64 * 1024)
+ return (EINVAL);
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0)