Skip to content

Commit

Permalink
perlfunc: Should chdir("/") immed after chroot
Browse files Browse the repository at this point in the history
Inspired by Coverity perl5 CID 28931: Insecure chroot: (CHROOT)
chroot_call.

The Perl chroot() is a thin wrapper around the system call, so the
chdir("/") should not go there.  But adding a note about the chdir()
being a good idea to perlfunc/chroot.

The committer reworded the inserted text for grammar and readability,
and the commit message to conform to git standards, and is pushing the
commit with the concurrence of the author.
  • Loading branch information
jhi authored and khwilliamson committed May 18, 2014
1 parent e023b52 commit b00d10d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pod/perlfunc.pod
Expand Up @@ -1012,6 +1012,9 @@ change your current working directory, which is unaffected.) For security
reasons, this call is restricted to the superuser. If FILENAME is
omitted, does a C<chroot> to C<$_>.

B<NOTE:> It is good security practice to do C<chdir("/")> (to the root
directory) immediately after a C<chroot()>.

Portability issues: L<perlport/chroot>.

=item close FILEHANDLE
Expand Down

0 comments on commit b00d10d

Please sign in to comment.