Cygwin: add secure_getenv

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
Yaakov Selkowitz
2019-02-18 23:06:11 -06:00
parent dd415f1a8c
commit 850705f92e
5 changed files with 17 additions and 1 deletions

View File

@@ -549,6 +549,16 @@ _getenv_r (struct _reent *, const char *name)
return findenv_func (name, &offset);
}
/* Like getenv, but returns NULL if effective and real UID/GIDs do not match */
extern "C" char *
secure_getenv (const char *name)
{
int offset;
if (cygheap->user.issetuid ())
return NULL;
return findenv_func (name, &offset);
}
/* Return number of environment entries, including terminating NULL. */
static int __stdcall
envsize (const char * const *in_envp)