commit:     c6a0c552339026b7379099c02592b07712264d06
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 12 21:26:25 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Dec 12 21:26:25 2015 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=c6a0c552

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.

 dumpelf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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(

Reply via email to