Fix #6921 - FPE on ext2 filesystem

This commit is contained in:
pancake 2017-03-09 21:37:09 +01:00
parent 9c870ef165
commit 6b515cae6a

View File

@ -523,7 +523,11 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
if (grub_errno)
return grub_errno;
inodes_per_block = EXT2_BLOCK_SIZE (data) / EXT2_INODE_SIZE (data);
int inode_size = EXT2_INODE_SIZE (data);
if (inode_size < 1) {
return grub_errno = GRUB_ERR_BAD_FS;
}
inodes_per_block = EXT2_BLOCK_SIZE (data) / inode_size;
if (inodes_per_block < 1) {
return grub_errno = GRUB_ERR_BAD_FS;
}