src: add SafeGetenv() to internal API

Allow it to be used anywhere in src/ that env variables with security
implications are accessed.
This commit is contained in:
Sam Roberts committed 2017-02-09 12:19:14 -08:00
1 parent 46edd940e8
commit 901e926d43
2 files changed
+3 -1
Notes: Sam Roberts 2017-02-14 13:11:43 -08:00
PR-URL: #11006
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

No files matched your search

+1 -1
View File
@@ -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.
+2
View File
@@ -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; }