in reply to Re: untainting or encoding for shelled sqlplus update
in thread untainting or encoding for shelled sqlplus update
Using DBI makes good sense. I don't use Oracle so can't test however according to this and other Google hits something like this may work. You may need to send a "set escape \" command to SQLPLUS too.
my @res_word = qw( ABOUT ACCUM AND BT BTG BTI BTP FUZZY HASPATH INPATH MINUS NEAR NOT NT NTG NTI NTP OR PT RT SQE SYN TR TRSYN TT WITHIN ); my @res_char = qw( , & ? { } \ ( ) [ ] - ; ~ | $ ! > * % _ ); my $rw = join '|', @res_word; $rw = qr/$rw/; my $rc = join '', map{"\\$_"}@res_char; $rc = qr/[$rc]/; sub escape { my $str = shift; $str =~ s/($rc)/\\$1/g; # reserved char escapes $str =~ s/($rw)/{$1}/g; # reserved word escapes $str =~ s/(['"])/$1$1/g; # quote escapes return $str; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: untainting or encoding for shelled sqlplus update
by goibhniu (Hermit) on May 15, 2008 at 21:15 UTC | |
by tachyon-II (Chaplain) on May 15, 2008 at 22:13 UTC | |
by goibhniu (Hermit) on May 16, 2008 at 14:21 UTC | |
by tachyon-II (Chaplain) on May 17, 2008 at 00:33 UTC | |
by goibhniu (Hermit) on May 19, 2008 at 14:06 UTC |