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