summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-12-08 20:48:45 +0100
committerMark Wielaard <mark@klomp.org>2021-12-09 19:34:19 +0100
commitc21c606602e1160c19d01e2836e23aa1a9e13432 (patch)
tree3de1a88fe2112c2f5c5ae461494b2c973701c546 /libdwfl
parentlibdwfl: Don't try to convert too many bytes in dwfl_link_map_report (diff)
downloadelfutils-c21c606602e1160c19d01e2836e23aa1a9e13432.tar.gz
elfutils-c21c606602e1160c19d01e2836e23aa1a9e13432.tar.bz2
elfutils-c21c606602e1160c19d01e2836e23aa1a9e13432.tar.xz
libdwfl: Make sure we know the phdr entry size before searching phdrs.
Without the program header entry size we cannot search through the phdrs. https://sourceware.org/bugzilla/show_bug.cgi?id=28657 Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog4
-rw-r--r--libdwfl/link_map.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 96251f0d..d875eabd 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,9 @@
12021-12-08 Mark Wielaard <mark@klomp.org> 12021-12-08 Mark Wielaard <mark@klomp.org>
2 2
3 * link_map.c (dwfl_link_map_report): Make sure phent != 0.
4
52021-12-08 Mark Wielaard <mark@klomp.org>
6
3 * link_map.c (dwfl_link_map_report): Limit malloc size to max 7 * link_map.c (dwfl_link_map_report): Limit malloc size to max
4 possible. When converting make sure we don't exceed the number 8 possible. When converting make sure we don't exceed the number
5 of bytes available in either in.d_buf nor out.d_buf. 9 of bytes available in either in.d_buf nor out.d_buf.
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index 1c298a8e..623b3062 100644
--- a/libdwfl/link_map.c
+++ b/libdwfl/link_map.c
@@ -784,7 +784,7 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
784 GElf_Xword dyn_filesz = 0; 784 GElf_Xword dyn_filesz = 0;
785 GElf_Addr dyn_bias = (GElf_Addr) -1; 785 GElf_Addr dyn_bias = (GElf_Addr) -1;
786 786
787 if (phdr != 0 && phnum != 0) 787 if (phdr != 0 && phnum != 0 && phent != 0)
788 { 788 {
789 Dwfl_Module *phdr_mod; 789 Dwfl_Module *phdr_mod;
790 int phdr_segndx = INTUSE(dwfl_addrsegment) (dwfl, phdr, &phdr_mod); 790 int phdr_segndx = INTUSE(dwfl_addrsegment) (dwfl, phdr, &phdr_mod);