Skip to content

Commit 6b515ca

Browse files
committed
Fix radareorg#6921 - FPE on ext2 filesystem
1 parent 9c870ef commit 6b515ca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

shlr/grub/fs/ext2.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
523523
if (grub_errno)
524524
return grub_errno;
525525

526-
inodes_per_block = EXT2_BLOCK_SIZE (data) / EXT2_INODE_SIZE (data);
526+
int inode_size = EXT2_INODE_SIZE (data);
527+
if (inode_size < 1) {
528+
return grub_errno = GRUB_ERR_BAD_FS;
529+
}
530+
inodes_per_block = EXT2_BLOCK_SIZE (data) / inode_size;
527531
if (inodes_per_block < 1) {
528532
return grub_errno = GRUB_ERR_BAD_FS;
529533
}

0 commit comments

Comments
 (0)