From: Martin Mares Date: Wed, 22 Feb 2017 15:12:00 +0000 (+0100) Subject: UCW::Configure: Translate local filenames to "./file" X-Git-Tag: v6.5.2~4 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=8b00c0af101bfe9c4c81a28df8ea9fe5a74cf639;p=libucw.git UCW::Configure: Translate local filenames to "./file" As a security measure, "require" in newer versions of Perl (5.22+) does not look up files relative to the current directory. --- diff --git a/ucw/perl/UCW/Configure.pm b/ucw/perl/UCW/Configure.pm index 5d458adb..70647a66 100644 --- a/ucw/perl/UCW/Configure.pm +++ b/ucw/perl/UCW/Configure.pm @@ -112,9 +112,11 @@ sub TestBool($$$) { sub TryFindFile($) { my ($f) = @_; - if (-f $f) { - return $f; - } elsif ($f !~ /^\// && -f (Get("SRCDIR")."/$f")) { + if ($f =~ m{^/}) { + return (-f $f) ? $f : undef; + } elsif (-f $f) { + return "./$f"; + } elsif (-f (Get("SRCDIR")."/$f")) { return Get("SRCDIR")."/$f"; } else { return undef;