in reply to Re^2: Form, Input, Taint related
in thread Form, Input, Taint related
This is the other alternative I was talking about. Is this as safe as using CGI.pm Input method?sub startup { $query=$ENV{'QUERY_STRING'}; if ($query) { @pairs=split(/&/,$query); } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); } foreach $pair (@pairs) { $something_in=1; ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; + } else { $INPUT{$name} = $value; } } } #then when I want to retrieve a value for the input field called "name +", then I will use: &startup; print "$INPUT{'name'}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Form, Input, Taint related
by merlyn (Sage) on Apr 15, 2005 at 20:48 UTC | |
|
Re^2: Form, Input, Taint related
by jhourcle (Prior) on Apr 15, 2005 at 22:03 UTC |