grub2/0145-grub_ufs_mount-Check-that-sblock.ino_per_group-is-no.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

44 lines
1.4 KiB
Diff

From 245e21b2b56e787ec5953efef6ac6ffe251e136b Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 14:30:05 +0100
Subject: [PATCH 145/506] grub_ufs_mount: Check that sblock.ino_per_group is
not 0.
---
ChangeLog | 5 +++++
grub-core/fs/ufs.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 454aef8..d7d5c40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/fs/ufs.c (grub_ufs_mount): Check
+ that sblock.ino_per_group is not 0.
+
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
Reject NILFS2 superblocks with over 1GiB blocks.
* grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that
diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c
index 4a2161c..f560ad3 100644
--- a/grub-core/fs/ufs.c
+++ b/grub-core/fs/ufs.c
@@ -604,7 +604,8 @@ grub_ufs_mount (grub_disk_t disk)
endiannesses. */
if (data->sblock.magic == grub_cpu_to_ufs32_compile_time (GRUB_UFS_MAGIC)
&& data->sblock.bsize != 0
- && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0))
+ && ((data->sblock.bsize & (data->sblock.bsize - 1)) == 0)
+ && data->sblock.ino_per_group != 0)
{
for (data->log2_blksz = 0;
(1U << data->log2_blksz) < grub_ufs_to_cpu32 (data->sblock.bsize);
--
2.4.3