aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-02-26 12:38:11 +1030
committerAlan Modra <amodra@gmail.com>2020-02-26 13:04:48 +1030
commit42135cadf5a3097df340eb85e96c0109a9842907 (patch)
treeab3cc080c902040c0266078b0de725827cd206b2 /gas/read.c
parentdc1e8a474f904419abaa27da4be5b0f735a87255 (diff)
downloadgdb-42135cadf5a3097df340eb85e96c0109a9842907.zip
gdb-42135cadf5a3097df340eb85e96c0109a9842907.tar.gz
gdb-42135cadf5a3097df340eb85e96c0109a9842907.tar.bz2
gas strncpy warning
Avoid a warning that the buffer may not be zero terminated. * read.c (read_a_source_file): Call strncpy with length one less than size of original_case_string.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gas/read.c b/gas/read.c
index e603099..784d6a8 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1052,7 +1052,8 @@ read_a_source_file (const char *name)
{
char *s2 = s;
- strncpy (original_case_string, s2, sizeof (original_case_string));
+ strncpy (original_case_string, s2,
+ sizeof (original_case_string) - 1);
original_case_string[sizeof (original_case_string) - 1] = 0;
while (*s2)