grub2/0152-osdep-linux-blocklist.c-grub_install_get_blocklist-C.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

43 lines
1.4 KiB
Diff

From 111ab3b9cc4ffbf0901d0303872d80a7e1c08a20 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 15:19:35 +0100
Subject: [PATCH 152/506] osdep/linux/blocklist.c (grub_install_get_blocklist):
Check blocksize validity.
---
ChangeLog | 5 +++++
grub-core/osdep/linux/blocklist.c | 2 ++
2 files changed, 7 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e8c1d68..87c4658 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/osdep/linux/blocklist.c (grub_install_get_blocklist): Check
+ blocksize validity.
+
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c
index f33a7d5..10ddd11 100644
--- a/grub-core/osdep/linux/blocklist.c
+++ b/grub-core/osdep/linux/blocklist.c
@@ -82,6 +82,8 @@ grub_install_get_blocklist (grub_device_t root_dev,
strerror (errno));
if (bsize & (GRUB_DISK_SECTOR_SIZE - 1))
grub_util_error ("%s", _("blocksize is not divisible by 512"));
+ if (!bsize)
+ grub_util_error ("%s", _("invalid zero blocksize"));
mul = bsize >> GRUB_DISK_SECTOR_BITS;
nblocks = (core_size + bsize - 1) / bsize;
if (mul == 0 || nblocks == 0)
--
2.4.3