GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: account for OpenSSL unexpected version · nodejs/node@b52c2ff

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_metadata.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_metadata.cc‎

Copy file name to clipboardExpand all lines: src/node_metadata.cc
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,23 @@ Metadata metadata;
5252

5353
#if HAVE_OPENSSL
5454
static constexpr size_t search(const char* s, char c, size_t n = 0) {
55-
return *s == c ? n : search(s + 1, c, n + 1);
55+
return *s == '\0' ? n : (*s == c ? n : search(s + 1, c, n + 1));
5656
}
5757

5858
static inline std::string GetOpenSSLVersion() {
5959
// sample openssl version string format
6060
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
6161
const char* version = OpenSSL_version(OPENSSL_VERSION);
62-
const size_t start = search(version, ' ') + 1;
62+
const size_t first_space = search(version, ' ');
63+
64+
// When Node.js is linked to an alternative library implementing the
65+
// OpenSSL API e.g. BoringSSL, the version string may not match the
66+
// expected pattern. In this case just return “0.0.0” as placeholder.
67+
if (version[first_space] == '\0') {
68+
return "0.0.0";
69+
}
70+
71+
const size_t start = first_space + 1;
6372
const size_t len = search(&version[start], ' ');
6473
return std::string(version, start, len);
6574
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.