From: Theodore Ts'o Date: Sun, 27 Jan 2008 05:14:01 +0000 (-0500) Subject: blkid: Make sure the blocksize in reiserfs is sane X-Git-Tag: v1.40.5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dc30dac2c2732e25765984263a3ecafd8c66932;p=thirdparty%2Fe2fsprogs.git 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" --- diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index f7bb49123..9bde79427 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -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;