From: "Petr Vaněk" <arkamar@atlas.cz>
To: musl@lists.openwall.com
Subject: [PATCH] add secure_getenv function
Date: Tue, 28 May 2019 22:47:48 +0200 [thread overview]
Message-ID: <20190528204748.GA2806@arkam> (raw)
This function is a GNU extension introduced in glibc 2.17.
---
include/stdlib.h | 1 +
src/env/secure_getenv.c | 8 ++++++++
2 files changed, 9 insertions(+)
create mode 100644 src/env/secure_getenv.c
diff --git a/include/stdlib.h b/include/stdlib.h
index 42ca8336..194c2033 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -152,6 +152,7 @@ int ptsname_r(int, char *, size_t);
char *ecvt(double, int, int *, int *);
char *fcvt(double, int, int *, int *);
char *gcvt(double, int, char *);
+char *secure_getenv(const char *);
struct __locale_struct;
float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
diff --git a/src/env/secure_getenv.c b/src/env/secure_getenv.c
new file mode 100644
index 00000000..72322f81
--- /dev/null
+++ b/src/env/secure_getenv.c
@@ -0,0 +1,8 @@
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include "libc.h"
+
+char *secure_getenv(const char *name)
+{
+ return libc.secure ? NULL : getenv(name);
+}
--
2.21.0
next reply other threads:[~2019-05-28 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 20:47 Petr Vaněk [this message]
2019-08-08 15:34 ` Rich Felker
2019-08-13 16:26 ` Petr Vaněk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190528204748.GA2806@arkam \
--to=arkamar@atlas.cz \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).