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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to