summaryrefslogtreecommitdiff
path: root/lib/libsndio
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-02-09 07:00:28 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-02-09 07:00:28 +0000
commit19bf4b5f28c79c2df300d8aff6b3e6e621bc0b54 (patch)
tree8837dd47521ca88700b341fd6068d120a0799053 /lib/libsndio
parentf474dca557e0be2c18280356f2f8403628838e11 (diff)
ignore evironment variables if the program is setuid or setgid
explained by deraadt, ok miod, ok millert
Diffstat (limited to 'lib/libsndio')
-rw-r--r--lib/libsndio/sndio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libsndio/sndio.c b/lib/libsndio/sndio.c
index 30003dc6312..c18afc136ac 100644
--- a/lib/libsndio/sndio.c
+++ b/lib/libsndio/sndio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sndio.c,v 1.13 2009/01/10 20:34:44 ratchov Exp $ */
+/* $OpenBSD: sndio.c,v 1.14 2009/02/09 07:00:27 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -166,7 +166,7 @@ sio_open(char *str, unsigned mode, int nbio)
if ((mode & (SIO_PLAY | SIO_REC)) == 0)
return NULL;
- if (str == NULL)
+ if (str == NULL && !issetugid())
str = getenv("AUDIODEVICE");
hdl = sio_open_aucat(str, mode, nbio);
if (hdl != NULL)
@@ -183,7 +183,7 @@ sio_create(struct sio_hdl *hdl, struct sio_ops *ops, unsigned mode, int nbio)
#ifdef DEBUG
char *dbg;
- dbg = getenv("SIO_DEBUG");
+ dbg = issetugid() ? NULL : getenv("SIO_DEBUG");
if (!dbg || sscanf(dbg, "%u", &hdl->debug) != 1)
hdl->debug = 0;
#endif