diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2017-01-28 13:27:02 +0100 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2017-02-08 06:23:19 -0800 |
commit | a8734af4422e6f8a4e3640971883577795796d6e (patch) | |
tree | e55f521eca430456cbd96ee15107dac6c48e71b8 /src/node_i18n.cc | |
parent | 62f513a9c8b397e84a78e109f367117bf4cdbdea (diff) | |
download | android-node-v8-a8734af4422e6f8a4e3640971883577795796d6e.tar.gz android-node-v8-a8734af4422e6f8a4e3640971883577795796d6e.tar.bz2 android-node-v8-a8734af4422e6f8a4e3640971883577795796d6e.zip |
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_i18n.cc')
-rw-r--r-- | src/node_i18n.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/node_i18n.cc b/src/node_i18n.cc index a98fdca4d1..40d048fa36 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -404,12 +404,8 @@ static void GetVersion(const FunctionCallbackInfo<Value>& args) { } } -bool InitializeICUDirectory(const char* icu_data_path) { - if (icu_data_path != nullptr) { - flag_icu_data_dir = true; - u_setDataDirectory(icu_data_path); - return true; // no error - } else { +bool InitializeICUDirectory(const std::string& path) { + if (path.empty()) { UErrorCode status = U_ZERO_ERROR; #ifdef NODE_HAVE_SMALL_ICU // install the 'small' data. @@ -418,6 +414,10 @@ bool InitializeICUDirectory(const char* icu_data_path) { // no small data, so nothing to do. #endif // !NODE_HAVE_SMALL_ICU return (status == U_ZERO_ERROR); + } else { + flag_icu_data_dir = true; + u_setDataDirectory(path.c_str()); + return true; // No error. } } |