diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2017-01-27 11:49:14 -0800 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2017-02-09 12:19:14 -0800 |
commit | 901e926d43a875af0bf2164c62770f7a835edf19 (patch) | |
tree | 516443eba209a92a914238faee9c50466d822062 /src | |
parent | 46edd940e82de589a6e9d0e78c1b5fdca42d7653 (diff) | |
download | android-node-v8-901e926d43a875af0bf2164c62770f7a835edf19.tar.gz android-node-v8-901e926d43a875af0bf2164c62770f7a835edf19.tar.bz2 android-node-v8-901e926d43a875af0bf2164c62770f7a835edf19.zip |
src: add SafeGetenv() to internal API
Allow it to be used anywhere in src/ that env variables with security
implications are accessed.
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 2 | ||||
-rw-r--r-- | src/node_internals.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/node.cc b/src/node.cc index 8c5e811d6e..d57665a9fd 100644 --- a/src/node.cc +++ b/src/node.cc @@ -924,7 +924,7 @@ Local<Value> UVException(Isolate* isolate, // Look up environment variable unless running as setuid root. -inline bool SafeGetenv(const char* key, std::string* text) { +bool SafeGetenv(const char* key, std::string* text) { #ifndef _WIN32 // TODO(bnoordhuis) Should perhaps also check whether getauxval(AT_SECURE) // is non-zero on Linux. diff --git a/src/node_internals.h b/src/node_internals.h index 9d57becc26..52fa17a812 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -114,6 +114,8 @@ void RegisterSignalHandler(int signal, bool reset_handler = false); #endif +bool SafeGetenv(const char* key, std::string* text); + template <typename T, size_t N> constexpr size_t arraysize(const T(&)[N]) { return N; } |