From 4dc30dac2c2732e25765984263a3ecafd8c66932 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 27 Jan 2008 00:14:01 -0500 Subject: [PATCH] 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" --- lib/blkid/probe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index f7bb491..9bde794 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; -- 1.8.3.1