summaryrefslogtreecommitdiff
path: root/libdwfl
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/dwfl_segment_report_module.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index d875eabd..76e0899e 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
2021-12-08 Mark Wielaard <mark@klomp.org>
+ * dwfl_segment_report_module.c (dwfl_segment_report_module): Don't
+ trust e_shentsize.
+
+2021-12-08 Mark Wielaard <mark@klomp.org>
+
* link_map.c (dwfl_link_map_report): Make sure phent != 0.
2021-12-08 Mark Wielaard <mark@klomp.org>
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index f6a1799e..be0aff76 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -383,7 +383,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
zero sh_size field. We ignore this here because getting shdrs
is just a nice bonus (see below in the type == PT_LOAD case
where we trim the last segment). */
- shdrs_end = ehdr.e32.e_shoff + ehdr.e32.e_shnum * ehdr.e32.e_shentsize;
+ shdrs_end = ehdr.e32.e_shoff + ehdr.e32.e_shnum * sizeof (Elf32_Shdr);
break;
case ELFCLASS64:
@@ -397,7 +397,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
if (phentsize != sizeof (Elf64_Phdr))
goto out;
/* See the NOTE above for shdrs_end and ehdr.e32.e_shnum. */
- shdrs_end = ehdr.e64.e_shoff + ehdr.e64.e_shnum * ehdr.e64.e_shentsize;
+ shdrs_end = ehdr.e64.e_shoff + ehdr.e64.e_shnum * sizeof (Elf64_Shdr);
break;
default: