aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-07-02 23:18:04 +0930
committerAlan Modra <amodra@gmail.com>2021-07-02 23:19:43 +0930
commit4ff0bb2df5e0ce6dc30b8dd2a0d4174649d0dcfe (patch)
tree428e46ba35484b348913f2b2ca89d7edfc9edc07 /binutils/dwarf.c
parent62194b631d00112bac1f8856d3259d774df4c15e (diff)
downloadgdb-4ff0bb2df5e0ce6dc30b8dd2a0d4174649d0dcfe.zip
gdb-4ff0bb2df5e0ce6dc30b8dd2a0d4174649d0dcfe.tar.gz
gdb-4ff0bb2df5e0ce6dc30b8dd2a0d4174649d0dcfe.tar.bz2
PR28048, heap-buffer-overflow on readelf -Ww
PR 28048 * dwarf.c (get_type_signedness): Don't run off end of buffer printing DW_FORM_string attribute.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r--binutils/dwarf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index de9d2b8..1e7f4db 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2211,7 +2211,7 @@ get_type_signedness (abbrev_entry *entry,
if (attr->form == DW_FORM_strp)
printf (", %s", fetch_indirect_string (uvalue));
else if (attr->form == DW_FORM_string)
- printf (", %s", orig_data);
+ printf (", %.*s", (int) (end - orig_data), orig_data);
}
break;