msdosfs: Fix a leak of dirent padding bytes

This was missed in r340856 / commit
6d2e2df764.  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
This commit is contained in:
Mark Johnston 2020-12-27 16:52:30 -05:00
parent 81846def34
commit 599f904463

View File

@ -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;