diff options
author | David Carlier <devnexen@gmail.com> | 2019-06-30 15:51:25 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-11 23:20:24 -0700 |
commit | fe1b96d460b8d8c7895e91b2ab57ee1fbc0f0052 (patch) | |
tree | fdea321a4b7c34587ef813a9fb4fb7ddc484e210 /src | |
parent | 1cc5c547d5f83097b7190d8186533bf176df6c9f (diff) | |
download | android-node-v8-fe1b96d460b8d8c7895e91b2ab57ee1fbc0f0052.tar.gz android-node-v8-fe1b96d460b8d8c7895e91b2ab57ee1fbc0f0052.tar.bz2 android-node-v8-fe1b96d460b8d8c7895e91b2ab57ee1fbc0f0052.zip |
src: clang build warning fix
fix UB with string concatenations. += operator makes things
clearer for compiler's perspective.
PR-URL: https://github.com/nodejs/node/pull/28480
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_metadata.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 602115ad4f..8c787138b4 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -34,8 +34,10 @@ std::string GetOpenSSLVersion() { // sample openssl version string format // 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, ' '); + const char* etext = OPENSSL_VERSION_TEXT; + const int start = search(etext, 0, ' ') + 1; + etext += start; + const int end = search(etext, start, ' '); const int len = end - start; snprintf(buf, sizeof(buf), "%.*s", len, &OPENSSL_VERSION_TEXT[start]); return std::string(buf); |