From 991cddad5324642b9660014c544e5a7346bb2260 Mon Sep 17 00:00:00 2001 From: Gregory Date: Wed, 5 Jun 2019 00:30:51 +0300 Subject: [PATCH] print all section names --- src/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index c44f357..2717a5c 100644 --- a/src/main.c +++ b/src/main.c @@ -44,15 +44,16 @@ int main(int argc, char **argv) } Elf64_Shdr *section_array; Elf64_Shdr *strings_table; + Elf64_Shdr *section_entity; section_array = (Elf64_Shdr *)(file + elf_header->e_shoff); strings_table = section_array + elf_header->e_shstrndx; char *string; - int i = 1; + int i = 0; while (i < elf_header->e_shnum) { - section_array = section_array + i; - string = (char *)(file + strings_table->sh_offset + section_array->sh_name); + section_entity = section_array + i; + string = (char *)(file + strings_table->sh_offset + section_entity->sh_name); printf("entity name: %s\n", string); i++; }