-
-
Save xdg/0d4840a388db440ea232638fafbd66e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/dist/PathTools/lib/File/Spec.pm b/dist/PathTools/lib/File/Spec.pm | |
index 85ad17426c..72b6dcdef9 100644 | |
--- a/dist/PathTools/lib/File/Spec.pm | |
+++ b/dist/PathTools/lib/File/Spec.pm | |
@@ -158,10 +158,13 @@ Returns a string representation of the parent directory. | |
=item no_upwards | |
-Given a list of file names, strip out those that refer to a parent | |
-directory. (Does not strip symlinks, only '.', '..', and equivalents.) | |
+Given a list of files in a directory (such as from C<readdir()>), | |
+strip out C<'.'> and C<'..'>. | |
- @paths = File::Spec->no_upwards( @paths ); | |
+B<SECURITY NOTE:> This does NOT filter paths containing C<'..'>, like | |
+C<'../../../../etc/passwd'>, only literal matches to C<'.'> and C<'..'>. | |
+ | |
+ @paths = File::Spec->no_upwards( readdir $dirhandle ); | |
=item case_tolerant | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment