the "newfile" parameter had no leading slash
- On Windows systems it was possible to access the directories above the root
directory by accessing a path ending with "..." or "...." and so on
if($newfile ne '' && $newfile !~ /^\s+$/)
{
$curdir = upper_path($file) if($curdir eq '');
if($newfile ne '' && $newfile !~ /^\s+$/)
{
$curdir = upper_path($file) if($curdir eq '');
- my $path = $curdir.$newfile;
+ my $path = $curdir.'/'.$newfile;
# Extract file and directory name...
# Extract file and directory name...
# Check if the path is above the root directory
return if(index($path,$root) != 0);
# Check if the path is above the root directory
return if(index($path,$root) != 0);
- return if($first eq $root && $last =~ m!^(/|\\)?\.\.(/|\\)?$!);
+ return if($first eq $root && ($last eq '..' || ($^O eq 'MSWin32' && $last =~ m!^\.\.+$!)));