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
df7d1e2023
commit
b23372cd8e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177367
@ -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…
Reference in New Issue
Block a user