Commit e44da0a9 authored by Jan Kara's avatar Jan Kara Committed by Zefan Li

isofs: Fix unchecked printing of ER records

commit 4e202462 upstream.

We didn't check length of rock ridge ER records before printing them.
Thus corrupted isofs image can cause us to access and print some memory
behind the buffer with obvious consequences.
Reported-and-tested-by: default avatarCarl Henrik Lunde <chlunde@ping.uio.no>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent 9939834c
...@@ -362,6 +362,9 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, ...@@ -362,6 +362,9 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
rs.cont_size = isonum_733(rr->u.CE.size); rs.cont_size = isonum_733(rr->u.CE.size);
break; break;
case SIG('E', 'R'): case SIG('E', 'R'):
/* Invalid length of ER tag id? */
if (rr->u.ER.len_id + offsetof(struct rock_ridge, u.ER.data) > rr->len)
goto out;
ISOFS_SB(inode->i_sb)->s_rock = 1; ISOFS_SB(inode->i_sb)->s_rock = 1;
printk(KERN_DEBUG "ISO 9660 Extensions: "); printk(KERN_DEBUG "ISO 9660 Extensions: ");
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment