Skip to content

Commit 901e926

Browse files
committed
src: add SafeGetenv() to internal API
Allow it to be used anywhere in src/ that env variables with security implications are accessed.
1 parent 46edd94 commit 901e926

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/node.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ Local<Value> UVException(Isolate* isolate,
924924

925925

926926
// Look up environment variable unless running as setuid root.
927-
inline bool SafeGetenv(const char* key, std::string* text) {
927+
bool SafeGetenv(const char* key, std::string* text) {
928928
#ifndef _WIN32
929929
// TODO(bnoordhuis) Should perhaps also check whether getauxval(AT_SECURE)
930930
// is non-zero on Linux.

src/node_internals.h

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ void RegisterSignalHandler(int signal,
114114
bool reset_handler = false);
115115
#endif
116116

117+
bool SafeGetenv(const char* key, std::string* text);
118+
117119
template <typename T, size_t N>
118120
constexpr size_t arraysize(const T(&)[N]) { return N; }
119121

0 commit comments

Comments
 (0)