clearenv.3: Clarify the use and effect of clearenv()

See http://bugs.debian.org/679323

Reported-by: Matt Zimmerman <mdz@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-02-19 13:04:51 +01:00
parent e44a70d63b
commit c66649c835
1 changed files with 17 additions and 2 deletions

View File

@ -88,7 +88,6 @@ adds only
and rejected
.BR clearenv ().
.SH NOTES
Used in security-conscious applications.
On systems where
.BR clearenv ()
is unavailable, the assignment
@ -98,7 +97,23 @@ is unavailable, the assignment
.fi
will probably do.
.LP
The
.BR clearenv ()
function may be useful in security-conscious applications that want to
precisely control the environment that is passed to programs
executed using
.BR exec (3).
The application would do this by first clearing the environment
and then adding select environment variables.
Note that the main effect of
.BR clearenv ()
is to adjust the value of the pointer
.BR environ (7);
this function does not erase the contents of the buffers
containing the environment definitions.
The DG/UX and Tru64 man pages write: If
.I environ
has been modified by anything other than the