git: c9ff56ce2d41 - main - tarfs: Terminate dirents before copying them out.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Mon, 06 Feb 2023 16:24:58 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=c9ff56ce2d4126eac79342eff2facafbbbd3f39c

commit c9ff56ce2d4126eac79342eff2facafbbbd3f39c
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-02-06 16:24:27 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-02-06 16:24:27 +0000

    tarfs: Terminate dirents before copying them out.
    
    Reported by:    markj
    Sponsored by:   Juniper Networks, Inc.
    Sponsored bu:   Klara, Inc.
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D38400
---
 sys/fs/tarfs/tarfs_vnops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/fs/tarfs/tarfs_vnops.c b/sys/fs/tarfs/tarfs_vnops.c
index a70a077424b4..43c434e370e3 100644
--- a/sys/fs/tarfs/tarfs_vnops.c
+++ b/sys/fs/tarfs/tarfs_vnops.c
@@ -294,6 +294,7 @@ tarfs_readdir(struct vop_readdir_args *ap)
 		cde.d_reclen = GENERIC_DIRSIZ(&cde);
 		if (cde.d_reclen > uio->uio_resid)
 			goto full;
+		dirent_terminate(&cde);
 		error = uiomove(&cde, cde.d_reclen, uio);
 		if (error)
 			return (error);
@@ -317,6 +318,7 @@ tarfs_readdir(struct vop_readdir_args *ap)
 		cde.d_reclen = GENERIC_DIRSIZ(&cde);
 		if (cde.d_reclen > uio->uio_resid)
 			goto full;
+		dirent_terminate(&cde);
 		error = uiomove(&cde, cde.d_reclen, uio);
 		if (error)
 			return (error);
@@ -374,6 +376,7 @@ tarfs_readdir(struct vop_readdir_args *ap)
 		cde.d_reclen = GENERIC_DIRSIZ(&cde);
 		if (cde.d_reclen > uio->uio_resid)
 			goto full;
+		dirent_terminate(&cde);
 		error = uiomove(&cde, cde.d_reclen, uio);
 		if (error != 0)
 			goto done;