From: Jan Kara Date: Thu, 18 Dec 2014 16:26:10 +0000 (+0100) Subject: isofs: Fix unchecked printing of ER records X-Git-Tag: v3.4.107~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44da0a95a798cbfbc1ec6760b3d1cfa531a9797;p=thirdparty%2Fkernel%2Fstable.git isofs: Fix unchecked printing of ER records commit 4e2024624e678f0ebb916e6192bd23c1f9fdf696 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: Carl Henrik Lunde Signed-off-by: Jan Kara Signed-off-by: Zefan Li --- diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index 26859dea2c46b..17809499c752d 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c @@ -362,6 +362,9 @@ repeat: rs.cont_size = isonum_733(rr->u.CE.size); break; 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; printk(KERN_DEBUG "ISO 9660 Extensions: "); {