]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
blkid: Make sure the blocksize in reiserfs is sane
authorTheodore Ts'o <tytso@mit.edu>
Sun, 27 Jan 2008 05:14:01 +0000 (00:14 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 27 Jan 2008 05:14:01 +0000 (00:14 -0500)
This avoids a floating point exception for corrupt reiserfs images

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/blkid/probe.c

index f7bb4912321e424fd981e3e8674bc34efaeca817..9bde79427374b3d17e9f292deae1a68c021a2603 100644 (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;