Skip to content

Commit e841ecb

Browse files
Lizhi Xuaalexandrovich
authored andcommitted
fs/ntfs3: Add sanity check for file name
The length of the file name should be smaller than the directory entry size. Reported-by: syzbot+598057afa0f49e62bd23@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=598057afa0f49e62bd23 Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent b1e9d89 commit e841ecb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/ntfs3/dir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,
304304
if (sbi->options->nohidden && (fname->dup.fa & FILE_ATTRIBUTE_HIDDEN))
305305
return true;
306306

307+
if (fname->name_len + sizeof(struct NTFS_DE) > le16_to_cpu(e->size))
308+
return true;
309+
307310
name_len = ntfs_utf16_to_nls(sbi, fname->name, fname->name_len, name,
308311
PATH_MAX);
309312
if (name_len <= 0) {

0 commit comments

Comments
 (0)