blkid: Make sure the blocksize in reiserfs is sane

This avoids a floating point exception for corrupt reiserfs images

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2008-01-27 00:14:01 -05:00
parent 3e9f86326d
commit 4dc30dac2c
1 changed files with 4 additions and 0 deletions

View File

@ -596,6 +596,10 @@ static int probe_reiserfs(struct blkid_probe *probe,
blocksize = blkid_le16(rs->rs_blocksize);
/* The blocksize must be at least 1k */
if ((blocksize >> 10) == 0)
return -BLKID_ERR_PARAM;
/* If the superblock is inside the journal, we have the wrong one */
if (id->bim_kboff/(blocksize>>10) > blkid_le32(rs->rs_journal_block))
return -BLKID_ERR_BIG;