mirror of
https://github.com/nodejs/node.git
synced 2025-08-20 09:25:30 +02:00
crypto: strip unwanted space from openssl version
Remove trailing " \n" from `process.versions.openssl`.d3d6cd3eca
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.9ed4646df0
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>
This commit is contained in:
parent
f1b95467dc
commit
bff53c5a9d
2 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ assert(/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
|
|||
.test(process.versions.v8));
|
||||
assert(/^\d+$/.test(process.versions.modules));
|
||||
|
||||
if (common.hasCrypto) {
|
||||
assert(/^\d+\.\d+\.\d+[a-z]?$/.test(process.versions.openssl));
|
||||
}
|
||||
|
||||
for (let i = 0; i < expected_keys.length; i++) {
|
||||
const key = expected_keys[i];
|
||||
const descriptor = Object.getOwnPropertyDescriptor(process.versions, key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue