]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdwl: Add validate_strdata to limit Elf_Data d_size to valid strings.
authorMark Wielaard <mark@klomp.org>
Sat, 21 Jun 2025 11:43:51 +0000 (13:43 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 24 Jun 2025 10:26:59 +0000 (12:26 +0200)
commit6136fe46258e2292abeab06703610ad58fb91aef
treed08c7560354e05aebb2cac2827cdce84cf45acf6
parent3cc287a29294bec86380a93020de71d8e8c636ac
libdwl: Add validate_strdata to limit Elf_Data d_size to valid strings.

dwfl_module_getsym returns the name of a symbol as found in the
corresponding (symbol) string section. Make sure all names are
correctly zero terminated by making sure the last valid index in a
section/segment Elf_Data contains a zero character.

* libdwfl/dwfl_module_getdwarf.c (validate_strdata): New
function taking Elf_Data and restricting d_size to last zero
char.
(translate_offs): Call validate_strdata.
(find_symtab): Likewise for both symstrdata and aux_symstrdata.

https://sourceware.org/bugzilla/show_bug.cgi?id=33099

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/dwfl_module_getdwarf.c