summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2018-10-15 15:15:26 -0700
committerSam Roberts <vieuxtech@gmail.com>2018-10-22 20:39:45 -0700
commitbff53c5a9d68eb15f3c9b41732b25ac649e6fbdd (patch)
tree0a313e51bc9477a4d36616f5b6bb865248d75b00 /src
parentf1b95467dc3b79a247d92d63a3b1539fcf348369 (diff)
downloadandroid-node-v8-bff53c5a9d68eb15f3c9b41732b25ac649e6fbdd.tar.gz
android-node-v8-bff53c5a9d68eb15f3c9b41732b25ac649e6fbdd.tar.bz2
android-node-v8-bff53c5a9d68eb15f3c9b41732b25ac649e6fbdd.zip
crypto: strip unwanted space from openssl version
Remove trailing " \n" from `process.versions.openssl`. d3d6cd3ecad19 was incorrectly printing this trailer, but because the target buffer size was claimed to be the length of the version string, the trailer was truncated off. 9ed4646df05b9 corrected the target buffer size, but then the trailer started to appear in process.versions. Added a test to check for regressions. PR-URL: https://github.com/nodejs/node/pull/23678 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_crypto.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index ec7d4f2bb5..122334351a 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -5715,9 +5715,9 @@ std::string GetOpenSSLVersion() {
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
char buf[128];
const int start = search(OPENSSL_VERSION_TEXT, 0, ' ') + 1;
- const int end = search(OPENSSL_VERSION_TEXT + start, start, ' ') + 1;
+ const int end = search(OPENSSL_VERSION_TEXT + start, start, ' ');
const int len = end - start;
- snprintf(buf, sizeof(buf), "%.*s\n", len, &OPENSSL_VERSION_TEXT[start]);
+ snprintf(buf, sizeof(buf), "%.*s", len, &OPENSSL_VERSION_TEXT[start]);
return std::string(buf);
}