[PATCH 1/2] hfs: abort hfs_lookup if name is too long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Long file names for hfs is 31 characters.

Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
---
 fs/hfs/dir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 86a6b317b474..30f6194da939 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -25,6 +25,9 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
 	struct inode *inode = NULL;
 	int res;
 
+	if (dentry->d_name.len > HFS_NAMELEN)
+		return ERR_PTR(-ENAMETOOLONG);
+
 	res = hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd);
 	if (res)
 		return ERR_PTR(res);
-- 
2.48.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux