git: a38033234692 - main - tarfs: Limit file name length
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Nov 2026 12:38:04 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=a38033234692e9dab6f3f4404adc693fccabc14a
commit a38033234692e9dab6f3f4404adc693fccabc14a
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-11-02 12:29:17 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-11-02 12:29:17 +0000
tarfs: Limit file name length
When indexing the tarball on mount, fail if a file or directory name
exceeds MAXNAMLEN.
Reported by: n0ps1ed
Reported by: Franz Bettag <franz@bett.ag>
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D60903
---
sys/fs/tarfs/tarfs_subr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/fs/tarfs/tarfs_subr.c b/sys/fs/tarfs/tarfs_subr.c
index 431aa352cd38..180e0a53f8b9 100644
--- a/sys/fs/tarfs/tarfs_subr.c
+++ b/sys/fs/tarfs/tarfs_subr.c
@@ -173,6 +173,8 @@ tarfs_alloc_node(struct tarfs_mount *tmp, const char *name, size_t namelen,
if (parent != NULL && parent->type != VDIR)
return (ENOTDIR);
+ if (namelen > NAME_MAX)
+ return (ENAMETOOLONG);
tnp = malloc(sizeof(struct tarfs_node), M_TARFSNODE, M_WAITOK | M_ZERO);
mtx_init(&tnp->lock, "tarfs node lock", NULL, MTX_DEF);
tnp->gen = arc4random();