From 5ad3e76c23576b2e216463bfe43d005a3e09defc Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 22 Jun 2022 12:36:02 +0200 Subject: [PATCH] put_str: Use memcpy instead of strncpy This fixes a warning from latest gcc. There is no point in using strncpy here as we intentionally copy only the string contents without the terminating NUL. The len is set from strlen(). Reviewed-by: Matt Caswell Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/18627) --- crypto/property/property_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c index cdfe477735..b2bf3cd631 100644 --- a/crypto/property/property_parse.c +++ b/crypto/property/property_parse.c @@ -600,7 +600,7 @@ static void put_str(const char *str, char **buf, size_t *remain, size_t *needed) len = *remain - 1; if (len > 0) { - strncpy(*buf, str, len); + memcpy(*buf, str, len); *buf += len; *remain -= len; }