[PATCH v2 01/21] elf: only accept images matching the native ELF_CLASS
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Jan 6 04:58:52 PST 2026
On 1/6/26 1:53 PM, Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> common/elf.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/common/elf.c b/common/elf.c
> index 18c541bf827e6077e64c15f62cb4abedc68cf278..a0e67a9353a12779ec841c53db7f6dba47070d8d 100644
> --- a/common/elf.c
> +++ b/common/elf.c
> @@ -213,6 +213,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;
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list