svn commit: r211818 - head/sys/kern
Brian Somers
brian at FreeBSD.org
Wed Aug 25 18:09:52 UTC 2010
Author: brian
Date: Wed Aug 25 18:09:51 2010
New Revision: 211818
URL: http://svn.freebsd.org/changeset/base/211818
Log:
If we read zero bytes from the directory, early out with ENOENT
rather than forging ahead and interpreting garbage buffer content
and dirent structures.
This change backs out r211684 which was essentially a no-op.
MFC after: 1 week
Modified:
head/sys/kern/vfs_default.c
Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c Wed Aug 25 16:23:50 2010 (r211817)
+++ head/sys/kern/vfs_default.c Wed Aug 25 18:09:51 2010 (r211818)
@@ -281,9 +281,13 @@ get_next_dirent(struct vnode *vp, struct
if (error)
return (error);
- *cpos = dirbuf;
- *len = uio.uio_offset - *off;
*off = uio.uio_offset;
+
+ *cpos = dirbuf;
+ *len = (dirbuflen - uio.uio_resid);
+
+ if (*len == 0)
+ return (ENOENT);
}
dp = (struct dirent *)(*cpos);
More information about the svn-src-all
mailing list