In dwfl_segment_report_module dyn_filesz should be able to hold at
least one Elf_Dyn element, and not be larger than possible.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2021-12-08 Mark Wielaard <mark@klomp.org>
* dwfl_segment_report_module.c (dwfl_segment_report_module): Make sure
+ that dyn_filesz can contain at least one Elf_Dyn and isn't larger than
+ possible.
+
+2021-12-08 Mark Wielaard <mark@klomp.org>
+
+ * dwfl_segment_report_module.c (dwfl_segment_report_module): Make sure
that ph_buffer_size has room for at least one phdr.
2021-12-08 Mark Wielaard <mark@klomp.org>
if (dyn_data_size != 0)
dyn_filesz = dyn_data_size;
+ if ((dyn_filesz / dyn_entsize) == 0
+ || dyn_filesz > (SIZE_MAX / dyn_entsize))
+ goto out;
void *dyns = malloc (dyn_filesz);
Elf32_Dyn *d32 = dyns;
Elf64_Dyn *d64 = dyns;