diff options
author | Mark Wielaard <[email protected]> | 2015-06-18 20:24:39 +0200 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2015-06-19 13:10:22 +0200 |
commit | 222cd82a154bc1805fa1631e8fa0269482d5be27 (patch) | |
tree | d356fe5bfd8f3de35f2980fdd7a1748d0f79ac4e | |
parent | 9075ff6aebb67d9ef2a5b53d1ae35c55590edcf7 (diff) |
readelf: Make sure phdr2_mem lifetime/scope equals phdr2 pointer.
We dont' want GCC to dispose or reuse phdr2_mem stack memory while phdr2
is pointing to it.
Signed-off-by: Mark Wielaard <[email protected]>
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/readelf.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d11b0e6b..80e451ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2015-06-18 Mark Wielaard <[email protected]> + * readelf.c (print_phdr): Make sure phdr2_mem lifetime/scope equals + phdr2 pointer. + +2015-06-18 Mark Wielaard <[email protected]> + * readelf.c (handle_gnu_hash): Free lengths on invalid_data. 2015-06-18 Mark Wielaard <[email protected]> diff --git a/src/readelf.c b/src/readelf.c index 9afe8dba..d3c2b6b4 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -1315,10 +1315,10 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) { /* Determine the segment this section is part of. */ size_t cnt2; + GElf_Phdr phdr2_mem; GElf_Phdr *phdr2 = NULL; for (cnt2 = 0; cnt2 < phnum; ++cnt2) { - GElf_Phdr phdr2_mem; phdr2 = gelf_getphdr (ebl->elf, cnt2, &phdr2_mem); if (phdr2 != NULL && phdr2->p_type == PT_LOAD |