Silcence a compile time warning message building the binutils with gcc-10 on an s390...
authorNick Clifton <nickc@redhat.com>
Fri, 7 Feb 2020 12:49:42 +0000 (12:49 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 7 Feb 2020 12:49:42 +0000 (12:49 +0000)
* dwarf.c (display_debug_lines_decoded): Force a NUL termination
of the truncated file name.

binutils/ChangeLog
binutils/dwarf.c

index 9585438687f8b2e03710e8b5233199268b855019..3edf233af1a9bd8d2d712b5e741983b0cc24c3f2 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-07  Nick Clifton  <nickc@redhat.com>
+
+       * dwarf.c (display_debug_lines_decoded): Force a NUL termination
+       of the truncated file name.
+
 2020-02-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * objdump.c (print_jump_visualisation): New function.
index 35842f74b2ed2b34002553e7bf505f88ea3a49f3..6ecfab5d5a797a7ae8af19b6295b67ae628508dd 100644 (file)
@@ -4905,6 +4905,11 @@ display_debug_lines_decoded (struct dwarf_section *  section,
                  strncpy (newFileName,
                           fileName + fileNameLength - MAX_FILENAME_LENGTH,
                           MAX_FILENAME_LENGTH + 1);
+                 /* FIXME: This is to pacify gcc-10 which can warn that the
+                    strncpy above might leave a non-NUL terminated string
+                    in newFileName.  It won't, but gcc's analysis doesn't
+                    quite go far enough to discover this.  */
+                 newFileName[MAX_FILENAME_LENGTH] = 0;
                }
              else
                {