:: commit 86a3dcd33b364854d301104bc69a0bdd4b5b8ed0

mintsuki <mintsuki@protonmail.com> — 2024-06-09 22:25

parents: 300cdc9498

lib/elf: Fix bug where the wrong struct was checked in elf64_load()

diff --git a/common/lib/elf.c b/common/lib/elf.c
index 6d7b5c5e..5811c3f9 100644
--- a/common/lib/elf.c
+++ b/common/lib/elf.c
@@ -771,7 +771,7 @@ bool elf64_load(uint8_t *elf, uint64_t *entry_point, uint64_t *_slide, uint32_t
         for (uint16_t j = 0; j < hdr->ph_num; j++) {
             struct elf64_phdr *phdr_in = (void *)elf + (hdr->phoff + j * hdr->phdr_size);
 
-            if (phdr_in->p_type != PT_LOAD || phdr->p_memsz == 0) {
+            if (phdr_in->p_type != PT_LOAD || phdr_in->p_memsz == 0) {
                 continue;
             }
 
tab: 248 wrap: offon