Date: Wed, 25 Aug 2010 18:09:52 +0000 (UTC) From: Brian Somers <brian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211818 - head/sys/kern Message-ID: <201008251809.o7PI9qdI018743@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008251809.o7PI9qdI018743>