Ensure that the section header table is written out in an order
consistent with the section indices returned to the application by elf_ndxscn(). Submitted by: kaiw
This commit is contained in:
parent
af7049a2cd
commit
f8600f40e7
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user