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.
This commit is contained in:
Alan Modra 2020-02-26 12:38:11 +10:30
parent dc1e8a474f
commit 42135cadf5
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2020-02-26 Alan Modra <amodra@gmail.com>
* read.c (read_a_source_file): Call strncpy with length one
less than size of original_case_string.
2020-02-26 Alan Modra <amodra@gmail.com>
* config/obj-elf.c: Indent labels correctly.

View File

@ -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)