]> granicus.if.org Git - curl/commitdiff
openssl: fix gcc8 warning
authorJay Satiro <raysatiro@yahoo.com>
Wed, 12 Sep 2018 07:14:20 +0000 (03:14 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Wed, 12 Sep 2018 07:14:20 +0000 (03:14 -0400)
- Use memcpy instead of strncpy to copy a string without termination,
  since gcc8 warns about using strncpy to copy as many bytes from a
  string as its length.

Suggested-by: Viktor Szakats
Closes https://github.com/curl/curl/issues/2980

lib/vtls/openssl.c

index d257d949007b46084187b0e394ed85d4bf109890..a9ba33038577d750064c392afb94a27d91eb0cd0 100644 (file)
@@ -253,7 +253,7 @@ static void ossl_keylog_callback(const SSL *ssl, const char *line)
       if(!buf)
         return;
     }
-    strncpy(buf, line, linelen);
+    memcpy(buf, line, linelen);
     buf[linelen] = '\n';
     buf[linelen + 1] = '\0';