aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-12 16:26:25 -0500
committerMike Frysinger <vapier@gentoo.org>2015-12-12 16:26:25 -0500
commitc6a0c552339026b7379099c02592b07712264d06 (patch)
treeaa5cf4f87064e1ea1782fef818b6f2ce4758645f
parentxarray: move ele update to after bounds check (diff)
downloadpax-utils-c6a0c552339026b7379099c02592b07712264d06.tar.gz
pax-utils-c6a0c552339026b7379099c02592b07712264d06.tar.bz2
pax-utils-c6a0c552339026b7379099c02592b07712264d06.zip
dumpelf: reset dynamic phdr pointer with every elf
When dumping multiple ELFs, the dynamic phdr pointer might be left pointing to memory from the previous ELF. Make sure we clear it at the start of every run.
-rw-r--r--dumpelf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dumpelf.c b/dumpelf.c
index e9b1771..0f15382 100644
--- a/dumpelf.c
+++ b/dumpelf.c
@@ -28,7 +28,7 @@ static void parseargs(int argc, char *argv[]);
static char be_verbose = 0;
/* misc dynamic tag caches */
-static void *phdr_dynamic_void = NULL;
+static void *phdr_dynamic_void;
/* dump all internal elf info */
static void dumpelf(const char *filename, long file_cnt)
@@ -40,6 +40,8 @@ static void dumpelf(const char *filename, long file_cnt)
if ((elf = readelf(filename)) == NULL)
return;
+ phdr_dynamic_void = NULL;
+
printf("#include <elf.h>\n");
printf(