syphilis has asked for the wisdom of the Perl Monks concerning the following question:
And that works quite well on linux, untainting $ENV{PATH} and leaving it intact. But on windows it clobbers $ENV{PATH}, leaving it empty.#===================================================================== +========= # Blindly untaint tainted fields in Inline object. #===================================================================== +========= sub env_untaint { my $o = shift; for (keys %ENV) { ($ENV{$_}) = $ENV{$_} =~ /(.*)/; } my $delim = $^O eq 'MSWin32' ? ';' : ':'; $ENV{PATH} = join $delim, grep {not /^\./ and -d $_ and not ((stat($_))[2] & 0022) } split $delim, $ENV{PATH}; map {($_) = /(.*)/} @INC; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Inline.pm and untainting
by ELISHEVA (Prior) on Jul 28, 2009 at 12:17 UTC | |
by CountZero (Bishop) on Jul 28, 2009 at 13:18 UTC | |
by ELISHEVA (Prior) on Jul 28, 2009 at 14:10 UTC | |
by syphilis (Archbishop) on Jul 28, 2009 at 23:45 UTC | |
by ELISHEVA (Prior) on Jul 29, 2009 at 06:32 UTC | |
| |
Re: Inline.pm and untainting
by blahblahblah (Priest) on Jul 29, 2009 at 03:14 UTC | |
by syphilis (Archbishop) on Jul 29, 2009 at 05:10 UTC | |
by afoken (Chancellor) on Jul 29, 2009 at 07:45 UTC | |
by Just in (Sexton) on Jul 29, 2009 at 08:11 UTC | |
by syphilis (Archbishop) on Jul 30, 2009 at 09:43 UTC | |
by afoken (Chancellor) on Jul 30, 2009 at 16:58 UTC | |
|