svn commit: r340859 - head/sys/fs/nandfs
Mark Johnston
markj at FreeBSD.org
Fri Nov 23 23:07:51 UTC 2018
Author: markj
Date: Fri Nov 23 23:07:49 2018
New Revision: 340859
URL: https://svnweb.freebsd.org/changeset/base/340859
Log:
Ensure the dirent remains initialized when dirent.d_fileno is unset.
Reported by: rmacklem
MFC with: r340856
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/fs/nandfs/nandfs_vnops.c
Modified: head/sys/fs/nandfs/nandfs_vnops.c
==============================================================================
--- head/sys/fs/nandfs/nandfs_vnops.c Fri Nov 23 22:37:35 2018 (r340858)
+++ head/sys/fs/nandfs/nandfs_vnops.c Fri Nov 23 23:07:49 2018 (r340859)
@@ -1226,6 +1226,7 @@ nandfs_readdir(struct vop_readdir_args *ap)
ndirent = (struct nandfs_dir_entry *)pos;
name_len = ndirent->name_len;
+ memset(&dirent, 0, sizeof(dirent));
dirent.d_fileno = ndirent->inode;
if (dirent.d_fileno) {
dirent.d_type = ndirent->file_type;
@@ -1243,7 +1244,7 @@ nandfs_readdir(struct vop_readdir_args *ap)
* If there isn't enough space in the uio to return a
* whole dirent, break off read
*/
- if (uio->uio_resid < dirent.d_reclen)
+ if (uio->uio_resid < GENERIC_DIRSIZ(&dirent))
break;
/* Transfer */
More information about the svn-src-head
mailing list