Skip to content

Commit

Permalink
fs/ntfs3: Fix oob in ntfs_listxattr
Browse files Browse the repository at this point in the history
[ Upstream commit 731ab1f ]

The length of name cannot exceed the space occupied by ea.

Reported-and-tested-by: syzbot+65e940cfb8f99a97aca7@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Edward Adam Davis authored and gregkh committed Mar 1, 2024
1 parent ded8bf5 commit 52fff57
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/ntfs3/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,
if (!ea->name_len)
break;

if (ea->name_len > ea_size)
break;

if (buffer) {
/* Check if we can use field ea->name */
if (off + ea_size > size)
Expand Down

0 comments on commit 52fff57

Please sign in to comment.