Browse Source

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)
Tomas Mraz 1 year ago
parent
commit
5ad3e76c23
1 changed files with 1 additions and 1 deletions
  1. 1 1
      crypto/property/property_parse.c

+ 1 - 1
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;
     }