This is a follow-up on
Item7558.
--
TWiki:Main/PeterThoeny
- 2014-10-01
Now fixed in SVN trunk and 6.0 branch.
Patch for vanilla 6.0.0 distribution:
--- TWiki/Sandbox.pm.save1 2014-10-01 19:50:45.000000000 -0400
+++ TWiki/Sandbox.pm 2014-10-01 20:13:31.000000000 -0400
@@ -194,8 +194,11 @@
# remember to test with IE.
$fileName =~ s{[\\/]+$}{}; # Get rid of trailing slash/backslash (unlikely)
$fileName =~ s!^.*[\\/]!!; # Get rid of directory part
+ $fileName =~ s/[\x00-\x19]//go; # Item7560: Remove non-printable characters
my $origName = $fileName;
+ # Item7560: Strip trailing dots
+ $fileName =~ s/\.*$//o;
# Change spaces to underscore
$fileName =~ s/ /_/go;
# Strip dots and slashes at start
@@ -214,6 +217,11 @@
# Append .txt to some files
$fileName =~ s/$TWiki::cfg{UploadFilter}/$1\.txt/goi;
+ # Item7483, prevent a null file name
+ if ( $fileName eq '' || $fileName =~ /^\./ ) {
+ $fileName = '_' . $fileName;
+ }
+
# Untaint
$fileName = untaintUnchecked($fileName);
--
TWiki:Main.PeterThoeny
- 2014-10-02