summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-02-16 15:36:33 +0100
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-02-16 15:51:14 +0100
commit997fc12ec91eccf6b7485565864f3eb8ce74def2 (patch)
treee10ca0c48d2c69624d2a1adbc0f346b13021b6ef /lib
parent1db561e11f2b6b6cd8f64035cc12b067dd6c1f91 (diff)
efi_loader: do not miss last relocation block
If the last block in the relocation table contains only a single relocation, the current coding ignores it. Fix the determination of the end of the relocation table. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_image_loader.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c
index cec17eabaa..fe66e7b9ff 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -111,7 +111,7 @@ static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
return EFI_SUCCESS;
end = (const IMAGE_BASE_RELOCATION *)((const char *)rel + rel_size);
- while (rel < end - 1 && rel->SizeOfBlock) {
+ while (rel < end && rel->SizeOfBlock) {
const uint16_t *relocs = (const uint16_t *)(rel + 1);
i = (rel->SizeOfBlock - sizeof(*rel)) / sizeof(uint16_t);
while (i--) {