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
This commit is contained in:
Ian Dowse 2001-08-10 22:14:18 +00:00
parent f34a9421b1
commit a9a8ba3d71
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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)