From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14530 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add secure_getenv function Date: Thu, 8 Aug 2019 11:34:09 -0400 Message-ID: <20190808153409.GF9017@brightrain.aerifal.cx> References: <20190528204748.GA2806@arkam> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="191701"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14546-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 08 17:34:25 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hvkQr-000niY-HV for gllmg-musl@m.gmane.org; Thu, 08 Aug 2019 17:34:25 +0200 Original-Received: (qmail 15632 invoked by uid 550); 8 Aug 2019 15:34:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15608 invoked from network); 8 Aug 2019 15:34:22 -0000 Content-Disposition: inline In-Reply-To: <20190528204748.GA2806@arkam> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14530 Archived-At: On Tue, May 28, 2019 at 10:47:48PM +0200, Petr Vaněk wrote: > 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 > +#include "libc.h" > + > +char *secure_getenv(const char *name) > +{ > + return libc.secure ? NULL : getenv(name); > +} > -- > 2.21.0 Sorry I overlooked this at the time. Applying it now. Thanks! Rich