* grub-core/fs/ext2.c (grub_ext2_mount): Additional checks for superblock validity.

This commit is contained in:
Vladimir Serbinenko 2015-01-20 14:40:27 +01:00
parent 245e21b2b5
commit 47cd2645dd
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/ext2.c (grub_ext2_mount): Additional
checks for superblock validity.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/ufs.c (grub_ufs_mount): Check

View file

@ -577,7 +577,12 @@ grub_ext2_mount (grub_disk_t disk)
/* Make sure this is an ext2 filesystem. */
if (data->sblock.magic != grub_cpu_to_le16_compile_time (EXT2_MAGIC)
|| grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16)
|| grub_le_to_cpu32 (data->sblock.log2_block_size) >= 16
|| data->sblock.inodes_per_group == 0
/* 20 already means 1GiB blocks. We don't want to deal with blocks overflowing int32. */
|| grub_le_to_cpu32 (data->sblock.log2_block_size) > 20
|| EXT2_INODE_SIZE (data) == 0
|| EXT2_BLOCK_SIZE (data) / EXT2_INODE_SIZE (data) == 0)
{
grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem");
goto fail;