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: [email protected] CC: [email protected] Signed-off-by: Jan Kara <[email protected]>
1 parent d0e36a6 commit e96a186

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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)