aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-12-27 21:52:30 +0000
committerMark Johnston <markj@FreeBSD.org>2020-12-27 22:01:44 +0000
commit599f90446376370eb365a0fde857ea2b5766873a (patch)
tree140d28909e91c345430d1a12870963c617c226c0
parent81846def349538d6dcd8d5efcc1c8d67ff0b4b41 (diff)
downloadsrc-599f90446376370eb365a0fde857ea2b5766873a.tar.gz
src-599f90446376370eb365a0fde857ea2b5766873a.zip
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 <faraz@elttam.com> MFC after: 3 days Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 857eefb384d9..b940633e0cfd 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1684,6 +1684,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;