diff options
-rw-r--r-- | lib/libelf/elf_update.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libelf/elf_update.c b/lib/libelf/elf_update.c index 64a38ea..988609b 100644 --- a/lib/libelf/elf_update.c +++ b/lib/libelf/elf_update.c @@ -788,15 +788,14 @@ _libelf_write_elf(Elf *e, off_t newsize) src.d_buf = &scn->s_shdr.s_shdr64; dst.d_size = fsz; - dst.d_buf = newfile + rc; + dst.d_buf = newfile + rc + scn->s_ndx * fsz; if (_libelf_xlate(&dst, &src, e->e_byteorder, ec, ELF_TOFILE) != &dst) goto error; - - rc += fsz; } + rc += e->e_u.e_elf.e_nscn * fsz; if (maxrc > rc) rc = maxrc; } |