Fix #1: Segmentation fault when using NOBITS sections #2

Merged
mhu merged 3 commits from fix-segmentation-fault into master 2023-01-04 15:11:49 +01:00
Showing only changes of commit 5b86194734 - Show all commits

View File

@ -232,9 +232,6 @@ static int elf_patch_update_info(elfpatch_handle_t *ep)
{ {
Elf_Kind ek; Elf_Kind ek;
const char *type_string = "unrecognized"; const char *type_string = "unrecognized";
size_t header_count = 0ull;
GElf_Phdr phdr;
size_t i;
ret_val_if_ep_err(ep, -1001); ret_val_if_ep_err(ep, -1001);
@ -276,20 +273,6 @@ static int elf_patch_update_info(elfpatch_handle_t *ep)
return -1; return -1;
} }
/* Get program headers */
if ( elf_getphdrnum(ep->elf, &header_count) != 0) {
print_err("Error reading count of program headers: %s\n", elf_errmsg(-1));
return -1;
}
for (i = 0ull; i < header_count; i++) {
if (gelf_getphdr(ep->elf, (int)i, &phdr) != &phdr) {
print_err("Error reading program header (%zu): %s\n", i, elf_errmsg(-1));
return -1;
}
print_debug("Read program header %zu\n", i);
}
return 0; return 0;
} }