mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
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 <[email protected]> MFC after: 1 week Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D60903
This commit is contained in:
1 parent
d667885130
commit
a380332346
1 file changed
+2
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user