Bug 35291: Validate filepaths in linking files
Validate that the files in linking files are contained within the ZIP.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bae5256216)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
f62231c9df
commit
8e4f99a9e7
|
|
@ -38,6 +38,7 @@ resized, maintaining aspect ratio.
|
|||
=cut
|
||||
|
||||
use Modern::Perl;
|
||||
use Cwd;
|
||||
|
||||
use File::Temp;
|
||||
use CGI qw ( -utf8 );
|
||||
|
|
@ -187,7 +188,11 @@ if ($fileID) {
|
|||
$filename =~ s/[\"\r\n]//g;
|
||||
$filename =~ s/^\s+//;
|
||||
$filename =~ s/\s+$//;
|
||||
my $srcimage = GD::Image->new("$dir/$filename");
|
||||
my $full_filename = Cwd::abs_path("$dir/$filename"); #Resolve any relative filepath references
|
||||
my $srcimage;
|
||||
if ( $full_filename =~ /^\Q$dir\E/ ){
|
||||
$srcimage = GD::Image->new($full_filename);
|
||||
}
|
||||
my $biblio;
|
||||
my $item;
|
||||
if ( defined $srcimage ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue