summaryrefslogtreecommitdiff
path: root/src/node_config.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-01-28 13:27:02 +0100
committerSam Roberts <vieuxtech@gmail.com>2017-02-08 06:23:19 -0800
commita8734af4422e6f8a4e3640971883577795796d6e (patch)
treee55f521eca430456cbd96ee15107dac6c48e71b8 /src/node_config.cc
parent62f513a9c8b397e84a78e109f367117bf4cdbdea (diff)
downloadnode-new-a8734af4422e6f8a4e3640971883577795796d6e.tar.gz
src: make copies of startup environment variables
Mutations of the environment can invalidate pointers to environment variables, so make `secure_getenv()` copy them out instead of returning pointers. PR-URL: https://github.com/nodejs/node/pull/11051 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'src/node_config.cc')
-rw-r--r--src/node_config.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/node_config.cc b/src/node_config.cc
index 60001207f1..a096372812 100644
--- a/src/node_config.cc
+++ b/src/node_config.cc
@@ -46,11 +46,12 @@ void InitConfig(Local<Object> target,
if (config_preserve_symlinks)
READONLY_BOOLEAN_PROPERTY("preserveSymlinks");
- if (config_warning_file != nullptr) {
+ if (!config_warning_file.empty()) {
Local<String> name = OneByteString(env->isolate(), "warningFile");
Local<String> value = String::NewFromUtf8(env->isolate(),
- config_warning_file,
- v8::NewStringType::kNormal)
+ config_warning_file.data(),
+ v8::NewStringType::kNormal,
+ config_warning_file.size())
.ToLocalChecked();
target->DefineOwnProperty(env->context(), name, value).FromJust();
}