Permalink
Browse files

Fix #7650 - Division by zero in Ext2 code from Grub

  • Loading branch information...
radare committed Jun 1, 2017
1 parent 9632f82 commit 9a21711c5d2fd1e0c4f8cf350ca7f793ca8958dc
Showing with 5 additions and 4 deletions.
  1. +5 −4 shlr/grub/fs/ext2.c
View
@@ -520,10 +520,11 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
/* It is easier to calculate if the first inode is 0. */
ino--;
grub_ext2_blockgroup (data,
ino / grub_le_to_cpu32 (sblock->inodes_per_group),
&blkgrp);
int div = grub_le_to_cpu32 (sblock->inodes_per_group);
if (div < 1) {
div = 1;
}
grub_ext2_blockgroup (data, ino / div, &blkgrp);
if (grub_errno)
return grub_errno;

0 comments on commit 9a21711

Please sign in to comment.