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 <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/18627)
This commit is contained in:
Tomas Mraz 2022-06-22 12:36:02 +02:00
parent e22ea36fa8
commit 5ad3e76c23

View File

@ -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;
}