2018-01-17 20:40:19 +00:00
|
|
|
From d5057e204cdbe73e42843719e65a7486eaa10fd7 Mon Sep 17 00:00:00 2001
|
2016-12-01 22:17:43 +00:00
|
|
|
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
|
Date: Mon, 21 Nov 2016 15:34:00 +0100
|
2018-01-17 20:40:19 +00:00
|
|
|
Subject: [PATCH 192/225] efi/chainloader: fix wrong sanity check in
|
2016-12-01 22:17:43 +00:00
|
|
|
relocate_coff()
|
|
|
|
|
|
|
|
In relocate_coff(), the relocation entries are parsed from the original
|
|
|
|
image (not the section-wise copied image). The original image is
|
|
|
|
pointed-to by the "orig" pointer. The current check
|
|
|
|
|
|
|
|
(void *)reloc_end < data
|
|
|
|
|
|
|
|
compares the addresses of independent memory allocations. "data" is a typo
|
|
|
|
here, it should be "orig".
|
|
|
|
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1347291
|
|
|
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
|
Tested-by: Bogdan Costescu <bcostescu@gmail.com>
|
|
|
|
Tested-by: Juan Orti <j.orti.alcaine@gmail.com>
|
|
|
|
---
|
|
|
|
grub-core/loader/efi/chainloader.c | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
2018-01-17 20:40:19 +00:00
|
|
|
index c9be56ef1..3cf8a7717 100644
|
2016-12-01 22:17:43 +00:00
|
|
|
--- a/grub-core/loader/efi/chainloader.c
|
|
|
|
+++ b/grub-core/loader/efi/chainloader.c
|
2017-06-16 19:31:32 +00:00
|
|
|
@@ -401,7 +401,7 @@ relocate_coff (pe_coff_loader_image_context_t *context,
|
2016-12-01 22:17:43 +00:00
|
|
|
reloc_end = (struct grub_pe32_fixup_block *)
|
|
|
|
((char *)reloc_base + reloc_base->size);
|
|
|
|
|
|
|
|
- if ((void *)reloc_end < data || (void *)reloc_end > image_end)
|
|
|
|
+ if ((void *)reloc_end < orig || (void *)reloc_end > image_end)
|
|
|
|
{
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "Reloc entry %d overflows binary",
|
|
|
|
n);
|
|
|
|
--
|
2018-01-17 20:40:19 +00:00
|
|
|
2.14.3
|
2016-12-01 22:17:43 +00:00
|
|
|
|