From: Tomas Mraz Date: Wed, 22 Jun 2022 10:36:02 +0000 (+0200) Subject: put_str: Use memcpy instead of strncpy X-Git-Tag: openssl-3.2.0-alpha1~2489 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ad3e76c23576b2e216463bfe43d005a3e09defc;p=thirdparty%2Fopenssl.git 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) --- diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c index cdfe4777353..b2bf3cd6318 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; }