Skip to content

Commit

Permalink
isofs: Fix out of bound access for corrupted isofs image
Browse files Browse the repository at this point in the history
When isofs image is suitably corrupted isofs_read_inode() can read data
beyond the end of buffer. Sanity-check the directory entry length before
using it.

Reported-and-tested-by: syzbot+6fc7fb214625d82af7d1@syzkaller.appspotmail.com
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Oct 19, 2021
1 parent d0e36a6 commit e96a186
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/isofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)

de = (struct iso_directory_record *) (bh->b_data + offset);
de_len = *(unsigned char *) de;
if (de_len < sizeof(struct iso_directory_record))
goto fail;

if (offset + de_len > bufsize) {
int frag1 = bufsize - offset;
Expand Down

0 comments on commit e96a186

Please sign in to comment.