Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2018 23:07:49 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340859 - head/sys/fs/nandfs
Message-ID:  <201811232307.wANN7oNH032722@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811232307.wANN7oNH032722>