diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 05ff7b3c..dcc06d0a 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -3136,7 +3136,7 @@ PackLinuxElf64::generateElfHdr( set_te64(&h2->phdr[C_TEXT].p_filesz, sizeof(*h2)); // + identsize; h2->phdr[C_TEXT].p_memsz = h2->phdr[C_TEXT].p_filesz; - for (unsigned j=0; j < 4; ++j) { + for (unsigned j=0; j < phnum_o; ++j) { if (PT_LOAD64==get_te32(&h3->phdr[j].p_type)) { set_te64(&h3->phdr[j].p_align, page_size); }