summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2010-04-20 11:17:57 -0700
committerNick Kralevich <nnk@google.com>2010-04-20 11:17:57 -0700
commit62c1bed1c4505369cac2e72fbe30452a598fb690 (patch)
tree0941e7968475a5c95f19d93d737cc41c958e6430
parentbe3f8e1b166f13cce6d9c682d300b8bacb5f414d (diff)
downloadelfcopy-62c1bed1c4505369cac2e72fbe30452a598fb690.tar.gz
When stripping a binary, soslim calls adjust_elf. adjust_elf copies over the elf program headers, making adjustments as necessary. Under some circumstances, the code which loops over all the program headers will fail to call gelf_update_phdr(). Instead of copying over the elf program header from the old binary to the new binary, a "NULL" header is written to the binary. Change-Id: I7afdc8e3af2638c386546f1bfe4f151e1f002087
-rw-r--r--elfcopy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/elfcopy.c b/elfcopy.c
index 1a32a59..ed1e6ce 100644
--- a/elfcopy.c
+++ b/elfcopy.c
@@ -1057,6 +1057,8 @@ void adjust_elf(Elf *elf, const char *elf_name,
INFO("PT_ header type: %d does not contain any sections.\n",
phdr_info[pi].p_type);
/* Move to the next program header. */
+ FAILIF_LIBELF(gelf_update_phdr (newelf, pi, &phdr_info[pi]) == 0,
+ gelf_update_phdr);
continue;
}