Avoid -Wstringop-truncation.

libiberty/ChangeLog:

	* dyn-string.c (dyn_string_insert_cstr): Use memcpy instead of strncpy
	to avoid -Wstringop-truncation.
This commit is contained in:
Martin Sebor 2021-02-01 08:58:31 -07:00
parent d7bd009ab0
commit 445d6db649

View File

@ -277,7 +277,7 @@ dyn_string_insert_cstr (dyn_string_t dest, int pos, const char *src)
for (i = dest->length; i >= pos; --i)
dest->s[i + length] = dest->s[i];
/* Splice in the new stuff. */
strncpy (dest->s + pos, src, length);
memcpy (dest->s + pos, src, length);
/* Compute the new length. */
dest->length += length;
return 1;