]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
display_debug_lines_decoded
authorAlan Modra <amodra@gmail.com>
Sat, 15 May 2021 05:24:55 +0000 (14:54 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 15 May 2021 05:27:38 +0000 (14:57 +0930)
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.

binutils/ChangeLog
binutils/dwarf.c

index 93a47cbbebbebcdc1b3bd84bedad8cfbe1e25b10..5efa9305a6d383f8f211e21bfe96a70cadf39b09 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 4f69dbb8f85c6dac2d9e2485c43d09e29200a3a9..e881ceecb7953de08df76d8279a73d26e75c36f1 100644 (file)
@@ -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,