Skip to content

Commit e96a186

Browse files
committed
isofs: Fix out of bound access for corrupted isofs image
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>
1 parent d0e36a6 commit e96a186

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/isofs/inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
13221322

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

13261328
if (offset + de_len > bufsize) {
13271329
int frag1 = bufsize - offset;

0 commit comments

Comments
 (0)