From a3540914c9de7d3fec75c730878551771cef0deb Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 12 Oct 2018 22:22:06 +0200 Subject: [PATCH] crypto: fix length argument to snprintf() Introduced in commit d3d6cd3eca ("src: improve SSL version extraction logic".) PR-URL: https://github.com/nodejs/node/pull/23622 Reviewed-By: Anna Henningsen Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell Reviewed-By: Hitesh Kanwathirtha Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann --- src/node_crypto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 1d621c0bc8ed64..2ab682cc2257c0 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5756,7 +5756,7 @@ std::string GetOpenSSLVersion() { const int start = search(OPENSSL_VERSION_TEXT, 0, ' ') + 1; const int end = search(OPENSSL_VERSION_TEXT + start, start, ' ') + 1; const int len = end - start; - snprintf(buf, len, "%.*s\n", len, &OPENSSL_VERSION_TEXT[start]); + snprintf(buf, sizeof(buf), "%.*s\n", len, &OPENSSL_VERSION_TEXT[start]); return std::string(buf); }