From 6615fe5db1b7b37e5ccc76c0d8790cfd48dc6b17 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 14 Jun 2024 16:51:42 +0000 Subject: [PATCH] src: fix dynamically linked OpenSSL version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Report the version of OpenSSL that Node.js is running with instead of the version of OpenSSL that Node.js was compiled against. PR-URL: https://github.com/nodejs/node/pull/53456 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen --- src/node_metadata.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 22546e9de25bdf..361b3596b4a65c 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -17,7 +17,7 @@ #include "zlib.h" #if HAVE_OPENSSL -#include +#include #if NODE_OPENSSL_HAS_QUIC #include #endif @@ -49,9 +49,10 @@ static constexpr size_t search(const char* s, char c, size_t n = 0) { static inline std::string GetOpenSSLVersion() { // sample openssl version string format // for reference: "OpenSSL 1.1.0i 14 Aug 2018" - constexpr size_t start = search(OPENSSL_VERSION_TEXT, ' ') + 1; - constexpr size_t len = search(&OPENSSL_VERSION_TEXT[start], ' '); - return std::string(OPENSSL_VERSION_TEXT, start, len); + const char* version = OpenSSL_version(OPENSSL_VERSION); + const size_t start = search(version, ' ') + 1; + const size_t len = search(&version[start], ' '); + return std::string(version, start, len); } #endif // HAVE_OPENSSL