aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-05-15 14:54:55 +0930
committerAlan Modra <amodra@gmail.com>2021-05-15 14:57:38 +0930
commit56051e28a33aa6b3c37a61d4647da324c21bc64d (patch)
treefce14f639ebb42ed84b91a376c1b8d86887da75a /binutils
parent37195e23e731744d2d61c97844e884634b592f77 (diff)
downloadgdb-56051e28a33aa6b3c37a61d4647da324c21bc64d.zip
gdb-56051e28a33aa6b3c37a61d4647da324c21bc64d.tar.gz
gdb-56051e28a33aa6b3c37a61d4647da324c21bc64d.tar.bz2
display_debug_lines_decoded
The directory_table strnlen used the negative of the proper size. After fixing that I realised we don't need strnlen here. * dwarf.c (display_debug_lines_decoded): Don't use strnlen when we have already checked for NUL termination.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/dwarf.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 93a47cb..5efa930 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,10 @@
2021-05-15 Alan Modra <amodra@gmail.com>
+ * dwarf.c (display_debug_lines_decoded): Don't use strnlen when
+ we have already checked for NUL termination.
+
+2021-05-15 Alan Modra <amodra@gmail.com>
+
* dwarf.c (read_debug_line_header): Delete initial_length_size.
Avoid pointer UB. Keep within length specified by header.
Delete dead code.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 4f69dbb..e881cee 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -5042,8 +5042,8 @@ display_debug_lines_decoded (struct dwarf_section * section,
while (*ptr_directory_table != 0)
{
directory_table[i] = ptr_directory_table;
- ptr_directory_table += strnlen ((char *) ptr_directory_table,
- ptr_directory_table - end) + 1;
+ ptr_directory_table
+ += strlen ((char *) ptr_directory_table) + 1;
i++;
}
}
@@ -5082,8 +5082,8 @@ display_debug_lines_decoded (struct dwarf_section * section,
while (*ptr_file_name_table != 0)
{
file_table[i].name = ptr_file_name_table;
- ptr_file_name_table += strnlen ((char *) ptr_file_name_table,
- end - ptr_file_name_table) + 1;
+ ptr_file_name_table
+ += strlen ((char *) ptr_file_name_table) + 1;
/* We are not interested in directory, time or size. */
READ_ULEB (file_table[i].directory_index,