From 71c9d7703fb2cd30ca6fa3a7542e4b3ac0a58292 Mon Sep 17 00:00:00 2001 From: gbrochar Date: Mon, 28 Oct 2024 14:01:34 +0100 Subject: [PATCH] last fix --- src/nm.c | 3 +++ src/nm32.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/nm.c b/src/nm.c index 8fa6b23..48fa820 100644 --- a/src/nm.c +++ b/src/nm.c @@ -140,6 +140,9 @@ int nm64(t_mapped_file mapped_file, char *path, t_verbosity verbosity, t_orderin if (get_header64(mapped_file, &header) == FT_NM_FAILURE) { return FT_NM_FAILURE; } + if (header.e_ehsize != 64) { + return FT_NM_FAILURE; + } uint64_t addr = header.e_shoff + header.e_shentsize * header.e_shstrndx; Elf64_Shdr *shstrtb; if (!(shstrtb = (Elf64_Shdr *)fetch(mapped_file, addr, header.e_shentsize))) { diff --git a/src/nm32.c b/src/nm32.c index 5b9162b..c2fd67b 100644 --- a/src/nm32.c +++ b/src/nm32.c @@ -140,6 +140,9 @@ int nm32(t_mapped_file mapped_file, char *path, t_verbosity verbosity, t_orderin if (get_header32(mapped_file, &header) == FT_NM_FAILURE) { return FT_NM_FAILURE; } + if (header.e_ehsize != 52) { + return FT_NM_FAILURE; + } uint32_t addr = header.e_shoff + header.e_shentsize * header.e_shstrndx; Elf32_Shdr *shstrtb; if (!(shstrtb = (Elf32_Shdr *)fetch(mapped_file, addr, header.e_shentsize))) {