From 445d6db6490393bcbdbdf2b7dc76a9f1a15402bb Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 1 Feb 2021 08:58:31 -0700 Subject: [PATCH] Avoid -Wstringop-truncation. libiberty/ChangeLog: * dyn-string.c (dyn_string_insert_cstr): Use memcpy instead of strncpy to avoid -Wstringop-truncation. --- libiberty/dyn-string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;