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:
Родитель
46edd940e8
Коммит
901e926d43
|
@ -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.
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче