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.
This commit is contained in:
Alan Modra
2021-07-02 23:18:04 +09:30
parent 62194b631d
commit 4ff0bb2df5
2 changed files with 7 additions and 1 deletions

View File

@ -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;