From: Martin Sebor Date: Mon, 1 Feb 2021 15:58:31 +0000 (-0700) Subject: Avoid -Wstringop-truncation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=445d6db6490393bcbdbdf2b7dc76a9f1a15402bb;p=gcc.git Avoid -Wstringop-truncation. libiberty/ChangeLog: * dyn-string.c (dyn_string_insert_cstr): Use memcpy instead of strncpy to avoid -Wstringop-truncation. --- diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c index ea711182ca5..8d2456b86c8 100644 --- a/libiberty/dyn-string.c +++ b/libiberty/dyn-string.c @@ -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;