Skip to content

Commit

Permalink
only mangle PATH if taint-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Dec 20, 2024
1 parent 40e8a19 commit 7fe658d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Photonic/Geometry/FromImage2D.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ use Moo;
use MooX::StrictConstructor;

BEGIN {
# Put inoffensive path. Or else, PDL::IO::Pic fails in taint mode.
$ENV{'PATH'} = '/bin:/usr/bin';
# Put inoffensive path in taint mode. Or else, PDL::IO::Pic fails.
$ENV{PATH} = '/bin:/usr/bin' if ${^TAINT};
}

use PDL::Lite;
Expand All @@ -119,7 +119,6 @@ sub _build_B {
my $self=shift;
my $path=$self->path;
( $path ) = ($path =~ m|^([A-Z0-9_.-\\/]+)$|ig);
($ENV{PATH})=($ENV{PATH}=~m|^([A-Z0-9_.-\\/]+)$|ig);
confess
"Only letters, numbers, underscores, dots, slashes and hyphens " .
"allowed in file names"
Expand Down

0 comments on commit 7fe658d

Please sign in to comment.