aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-02-07 12:49:42 +0000
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-05-08 20:44:27 +0300
commit8abfc9a403c9ad2c5648ad853a41ddc2e134aebb (patch)
tree9f58bd016846d08e12a26c02112bcdf908aeea3b
parentbfd: Change num_group to unsigned int (diff)
downloadbinutils-gdb-8abfc9a403c9ad2c5648ad853a41ddc2e134aebb.tar.gz
binutils-gdb-8abfc9a403c9ad2c5648ad853a41ddc2e134aebb.tar.bz2
binutils-gdb-8abfc9a403c9ad2c5648ad853a41ddc2e134aebb.zip
Fix dwarf.c build with GCC 10
Silcence a compile time warning message building the binutils with gcc-10. * dwarf.c (display_debug_lines_decoded): Force a NUL termination of the truncated file name. (cherry picked from commit e1104d08fe2fbfabcfa98aa00525211e47548bd8) (cherry picked from commit b6520be37fd59993c5b6bed1fe2a185fb7a1f996)
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/dwarf.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 24b0515fd6..fadd317151 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-24 Nick Clifton <nickc@redhat.com>
+
+ * dwarf.c (display_debug_lines_decoded): Force a NUL termination
+ of the truncated file name.
+
2020-02-25 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/25584
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 35842f74b2..6ecfab5d5a 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -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
{