aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-12-27 21:52:30 +0000
committerEd Maste <emaste@FreeBSD.org>2021-01-29 00:59:53 +0000
commitbec758f641df1de04aca2633bfda6b1bacb48415 (patch)
tree65272d8f0ac4afe41c90a8fffd843e9dda851c12
parent66ace87da47b8036dd8ac2ab2e66ab0042c0d252 (diff)
downloadsrc-bec758f641df1de04aca2633bfda6b1bacb48415.tar.gz
src-bec758f641df1de04aca2633bfda6b1bacb48415.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> (cherry picked from commit 599f90446376370eb365a0fde857ea2b5766873a) (cherry picked from commit 5ece34669c27a61f78cd0f6e0759c17f7787aebb) Approved by: so Security: CVE-2020-25579
-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 8bd944661420..b5a5409c2582 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;