in reply to Re: Re: Why do I need -w in a cgi script
in thread Why do I need -w in a cgi script
#!/usr/bin/perl -T use strict; use warnings; my $file = shift; open my $fh => $file or die $!; while (<$fh>) {print} close $fh; __END__
A fairly trivial one. Takes only one parameter. You test it with a million files. It all works fine. You remove the '-T' and put it in production, where it's going to be run suid or called by a CGI program, or whatever.
Then some joker passes "> /some/important/file" as argument. With "-T", perl would not have wiped the content of the file. Without, it will.
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Why do I need -w in a cgi script
by Melly (Chaplain) on Oct 10, 2003 at 14:27 UTC | |
by Abigail-II (Bishop) on Oct 10, 2003 at 14:47 UTC |