From bec4233ff688d47e6b005c1a60375e2e0f6be46a Mon Sep 17 00:00:00 2001 From: ThisALV <69650954+ThisALV@users.noreply.github.com> Date: Mon, 21 Dec 2020 21:03:59 +0100 Subject: [PATCH] Fixed ELF header pattern (#7) * Fixed ELF header pattern * Fix : missing pattern offset --- patterns/elf.hexpat | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/patterns/elf.hexpat b/patterns/elf.hexpat index a9708d3..7441916 100644 --- a/patterns/elf.hexpat +++ b/patterns/elf.hexpat @@ -1,5 +1,7 @@ #pragma MIME application/x-executable +#define EI_NIDENT 16 + using Elf32_Addr = u32; using Elf32_Half = u16; using Elf32_Off = u32; @@ -13,13 +15,13 @@ using Elf64_Sword = s32; using Elf64_Word = u32; struct Elf32_Ehdr { - Elf32_Word e_ident; + u8 e_ident[EI_NIDENT]; Elf32_Half e_type; Elf32_Half e_machine; Elf32_Word e_version; Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; + Elf32_Off e_phoff; + Elf32_Off e_shoff; Elf32_Word e_flags; Elf32_Half e_ehsize; Elf32_Half e_phentsize; @@ -30,7 +32,7 @@ struct Elf32_Ehdr { }; struct Elf64_Ehdr { - Elf64_Word e_ident; + u8 e_ident[EI_NIDENT]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; @@ -46,4 +48,4 @@ struct Elf64_Ehdr { Elf64_Half e_shstrndx; }; -Elf64_Ehdr header @ 0x00; \ No newline at end of file +Elf64_Ehdr header @ 0x00;