From b504d96674ba3684882fcc1244a23b7439f12b63 Mon Sep 17 00:00:00 2001 From: kangenbo Date: Fri, 8 Mar 2019 11:01:34 -0500 Subject: [PATCH] openssl: fix gcc8 warning 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. Closes https://github.com/curl/curl/issues/2980 --- lib/vtls/openssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index a487f55..955b661 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -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'; -- 1.8.3.1