From 50dd36a50ad76dee11edd67e69b5e0da11871fad Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 27 Dec 2016 09:24:07 +0100 Subject: add secure_getenv() function --- libc/stdlib/Makefile.in | 2 +- libc/stdlib/secure_getenv.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 libc/stdlib/secure_getenv.c (limited to 'libc') diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in index f6e471ac5..938f74448 100644 --- a/libc/stdlib/Makefile.in +++ b/libc/stdlib/Makefile.in @@ -17,7 +17,7 @@ CSRC-y := \ lldiv.c getpt.c drand48-iter.c jrand48.c \ jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \ nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \ - a64l.c l64a.c __uc_malloc.c + a64l.c l64a.c __uc_malloc.c secure_getenv.c CSRC-$(UCLIBC_SUSV2_LEGACY) += valloc.c CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c CSRC-$(UCLIBC_HAS_PTY) += grantpt.c unlockpt.c ptsname.c diff --git a/libc/stdlib/secure_getenv.c b/libc/stdlib/secure_getenv.c new file mode 100644 index 000000000..41cb622c8 --- /dev/null +++ b/libc/stdlib/secure_getenv.c @@ -0,0 +1,8 @@ + +#include + +char *secure_getenv(const char *name) { + if (issetugid()) return NULL; + return getenv(name); +} + -- cgit v1.2.3