From 5ece34669c27a61f78cd0f6e0759c17f7787aebb Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sun, 27 Dec 2020 16:52:30 -0500 Subject: [PATCH] msdosfs: Fix a leak of dirent padding bytes This was missed in r340856 / commit 6d2e2df764199f0a15fd743e79599391959cc17d. Three bytes from the kernel stack may be leaked when reading directory entries. Reported by: Syed Faraz Abrar (cherry picked from commit 599f90446376370eb365a0fde857ea2b5766873a) --- sys/fs/msdosfs/msdosfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 40757420adc..d700f6a62d5 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1687,6 +1687,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) dirbuf.d_reclen = GENERIC_DIRSIZ(&dirbuf); /* NOTE: d_off is the offset of the *next* entry. */ dirbuf.d_off = offset + sizeof(struct direntry); + dirent_terminate(&dirbuf); if (uio->uio_resid < dirbuf.d_reclen) { brelse(bp); goto out; -- 2.45.0