zdump: df_elf: ehdr_is_elf_object: add ELF version check

Currently, only the ELF version `1` is defined by the ELF specification. See
`man 5 elf` for details. Therefore of course, we do only support this version.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2021-11-15 11:02:33 +01:00
committed by Jan Höppner
parent 922e8cbb2f
commit 1780efae07

View File

@@ -38,7 +38,7 @@ void *ehdr_init(Elf64_Ehdr *ehdr, Elf64_Half phnum)
bool ehdr_is_elf_object(const Elf64_Ehdr *ehdr)
{
return (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0);
return (ehdr->e_version == ELF_VERSION_1) && (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) == 0);
}
bool ehdr_is_vmcore(const Elf64_Ehdr *ehdr)