libelf: also test for 64-bit ELF in _libelf_is_mips64el
Although _libelf_is_mips64el is only called in contexts where we've already checked that e_class is ELFCLASS64 but this may change in the future. Add a safety belt so that we don't access an invalid e_ehdr64 union member if it does. Reported by: jkoshy (in review D17380)
This commit is contained in:
parent
707a657cbf
commit
447a8c25fe
@ -34,7 +34,7 @@ int
|
||||
_libelf_is_mips64el(Elf *e)
|
||||
{
|
||||
|
||||
return (e->e_kind == ELF_K_ELF &&
|
||||
return (e->e_kind == ELF_K_ELF && e->e_class == ELFCLASS64 &&
|
||||
e->e_u.e_elf.e_ehdr.e_ehdr64->e_machine == EM_MIPS &&
|
||||
e->e_u.e_elf.e_ehdr.e_ehdr64->e_ident[EI_DATA] == ELFDATA2LSB);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user