Reviewed-by: Ahmad Fatoum <[email protected]>
Signed-off-by: Sascha Hauer <[email protected]>
---
common/elf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/elf.c b/common/elf.c
index 34d790bad3..f772018deb 100644
--- a/common/elf.c
+++ b/common/elf.c
@@ -208,6 +208,9 @@ static int elf_check_image(struct elf_image *elf, void *buf)
return -ENOEXEC;
}
+ if (elf->class != ELF_CLASS)
+ return -EINVAL;
+
if (!elf_hdr_e_phnum(elf, buf)) {
pr_err("No phdr found.\n");
return -ENOEXEC;
--
2.47.3