Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbc54d4

Browse filesBrowse files
sam-githubMylesBorins
authored andcommitted
crypto: strip unwanted space from openssl version
Remove trailing " \n" from `process.versions.openssl`. d3d6cd3 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. 9ed4646 corrected the target buffer size, but then the trailer started to appear in process.versions. Added a test to check for regressions. PR-URL: #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>
1 parent d1c0827 commit cbc54d4
Copy full SHA for cbc54d4

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5733,9 +5733,9 @@ std::string GetOpenSSLVersion() {
57335733
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
57345734
char buf[128];
57355735
const int start = search(OPENSSL_VERSION_TEXT, 0, ' ') + 1;
5736-
const int end = search(OPENSSL_VERSION_TEXT + start, start, ' ') + 1;
5736+
const int end = search(OPENSSL_VERSION_TEXT + start, start, ' ');
57375737
const int len = end - start;
5738-
snprintf(buf, sizeof(buf), "%.*s\n", len, &OPENSSL_VERSION_TEXT[start]);
5738+
snprintf(buf, sizeof(buf), "%.*s", len, &OPENSSL_VERSION_TEXT[start]);
57395739
return std::string(buf);
57405740
}
57415741

Collapse file

‎test/parallel/test-process-versions.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-versions.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ assert(/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
3333
.test(process.versions.v8));
3434
assert(/^\d+$/.test(process.versions.modules));
3535

36+
if (common.hasCrypto) {
37+
assert(/^\d+\.\d+\.\d+[a-z]?$/.test(process.versions.openssl));
38+
}
39+
3640
for (let i = 0; i < expected_keys.length; i++) {
3741
const key = expected_keys[i];
3842
const descriptor = Object.getOwnPropertyDescriptor(process.versions, key);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.