summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Menzel <pmenzel@molgen.mpg.de>2018-05-23 12:32:37 +0200
committerPeter Jones <pjones@redhat.com>2020-07-23 20:51:18 -0400
commit956717e2b375d7c7f0faafec8f12a7692708eb9a (patch)
tree84557782ec8bfd525d11aa03f4a1d00222ddeaf2
parent85c837d67fef9cd831a3126398ed8da1421f61c5 (diff)
downloadefi-boot-shim-956717e2b375d7c7f0faafec8f12a7692708eb9a.tar.gz
efi-boot-shim-956717e2b375d7c7f0faafec8f12a7692708eb9a.zip
shim: Extend invalid reloc size warning message
Knowing the value of the reloc directory size is helpful for debugging, cf. issue #131 [1], [1]: https://github.com/rhboot/shim/issues/131 Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Upstream-commit-id: dd3230d07f3
-rw-r--r--shim.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/shim.c b/shim.c
index ff081700..05fc6500 100644
--- a/shim.c
+++ b/shim.c
@@ -280,8 +280,14 @@ static EFI_STATUS relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context,
while (RelocBase < RelocBaseEnd) {
Reloc = (UINT16 *) ((char *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
- if ((RelocBase->SizeOfBlock == 0) || (RelocBase->SizeOfBlock > context->RelocDir->Size)) {
- perror(L"Reloc %d block size %d is invalid\n", n, RelocBase->SizeOfBlock);
+ if (RelocBase->SizeOfBlock == 0) {
+ perror(L"Reloc %d block size 0 is invalid\n", n);
+ return EFI_UNSUPPORTED;
+ } else if (RelocBase->SizeOfBlock > context->RelocDir->Size) {
+ perror(L"Reloc %d block size %d greater than reloc dir"
+ "size %d, which is invalid\n", n,
+ RelocBase->SizeOfBlock,
+ context->RelocDir->Size);
return EFI_UNSUPPORTED;
}