summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/getenv.3
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-07-11 09:24:03 +0000
committertedu <tedu@openbsd.org>2014-07-11 09:24:03 +0000
commit2ae792798cafba2ad0781d0031094a615d4ce1cd (patch)
tree23703f3b410b0f6aa4e737f218c3fd702bdbee76 /lib/libc/stdlib/getenv.3
parentThe only thing openssl is consistant about is inconsistancy, so there (diff)
downloadwireguard-openbsd-2ae792798cafba2ad0781d0031094a615d4ce1cd.tar.xz
wireguard-openbsd-2ae792798cafba2ad0781d0031094a615d4ce1cd.zip
better document perils of setuid getenv and xr with issetugid
ok deraadt
Diffstat (limited to 'lib/libc/stdlib/getenv.3')
-rw-r--r--lib/libc/stdlib/getenv.312
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
index 23335595161..ce2ef43b6f3 100644
--- a/lib/libc/stdlib/getenv.3
+++ b/lib/libc/stdlib/getenv.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: getenv.3,v 1.20 2014/04/21 08:46:59 guenther Exp $
+.\" $OpenBSD: getenv.3,v 1.21 2014/07/11 09:24:03 tedu Exp $
.\"
-.Dd $Mdocdate: April 21 2014 $
+.Dd $Mdocdate: July 11 2014 $
.Dt GETENV 3
.Os
.Sh NAME
@@ -145,6 +145,7 @@ function failed because it was unable to allocate memory for the environment.
.Xr csh 1 ,
.Xr sh 1 ,
.Xr execve 2 ,
+.Xr issetugid 2 ,
.Xr environ 7
.Sh STANDARDS
The
@@ -175,3 +176,10 @@ The
.Fn putenv
function appeared in
.Bx 4.3 Reno .
+.Sh CAVEATS
+Library code must be careful about using
+.Fn getenv
+to read untrusted environment variables in setuid programs.
+The
+.Fn issetugid
+function is provided for this purpose.