McGaida has asked for the wisdom of the Perl Monks concerning the following question:
Hallo I am working on a script that will run with SUID rights, so I have to clean all values that came from outside and that is okay for me, but now I run in the following problem and I am totally confused maybe somebody can help me.
Code version not working:
if ($value =~ /^([\w|\s|\/|\-]+)$/) { $value = $1; } else { die "Reg. exp. failed: $value!\n"; }
The reg.exp. is working, but leaves $value tainted
Code version working but senseless
if ($value =~ /^(.+)$/) { $value = $1; } else { die "Reg. exp. failed: $value!\n"; }
Now $value is untained
I am on a Solaris 10 x64 system with perl version 5.8.4
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: taint mode
by Athanasius (Archbishop) on Mar 17, 2015 at 09:48 UTC | |
by McGaida (Initiate) on Mar 17, 2015 at 14:08 UTC | |
Re: taint mode
by Anonymous Monk on Mar 17, 2015 at 07:50 UTC | |
by McGaida (Initiate) on Mar 17, 2015 at 08:38 UTC | |
by Anonymous Monk on Mar 17, 2015 at 09:18 UTC | |
by McGaida (Initiate) on Mar 17, 2015 at 14:05 UTC | |
by Anonymous Monk on Mar 19, 2015 at 07:18 UTC |