diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-26 00:17:29 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-26 00:17:29 +0000 |
commit | 1ac73728e4fb9188de899a35eb12fe3adad86b1d (patch) | |
tree | 214153b9363774b96c668b1dc2cfb1b9c7307b3b /lib/libc/locale/setlocale.c | |
parent | 05a1c82cea94423f31eeffcde116ad3b225de98e (diff) |
use issetugid() to protect against bad getenv
Diffstat (limited to 'lib/libc/locale/setlocale.c')
-rw-r--r-- | lib/libc/locale/setlocale.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c index 5f34ca19d10..a7ee9fe56c6 100644 --- a/lib/libc/locale/setlocale.c +++ b/lib/libc/locale/setlocale.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: setlocale.c,v 1.2 1996/08/19 08:28:24 tholo Exp $"; +static char rcsid[] = "$OpenBSD: setlocale.c,v 1.3 1996/08/26 00:17:18 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/localedef.h> @@ -91,7 +91,8 @@ setlocale(category, locale) int found, i, len; char *env, *r; - if (!PathLocale && !(PathLocale = getenv("PATH_LOCALE"))) + if (issetugid() != 0 || + (!PathLocale && !(PathLocale = getenv("PATH_LOCALE")))) PathLocale = _PATH_LOCALE; if (category < 0 || category >= _LC_LAST) |