Subject: | problems in Taint-Mode (with fix) |
Date: | Thu, 04 Jan 2007 23:40:25 +0100 |
To: | bug-dbd-pg [...] rt.cpan.org |
From: | Jochen Schroer <schroer [...] ecs-solution.de> |
Hi,
I get some problems with DBD::Pg if I use perl in Taint Mode (perl -T).
At the code-part where Pg tryed to findout some information about the
primary-key the variable $oid is marked as tainted.
I just fix it by checking if $oid is really a integer, feel free to
implement a more nifty solution.
Kind regards,
Jochen Schroer
*** Pg.pm Thu Jan 4 23:27:36 2007
--- /usr/lib/perl5/DBD/Pg.pm Thu Jan 4 23:24:06 2007
***************
*** 267,272 ****
--- 267,274 ----
return $dbh->set_err(1, $message);
}
my $oid = $sth->fetchall_arrayref()->[0][0];
+ $oid =~ m/(\d+)/g;
+ $oid = $1;
## This table has a primary key. Is there a
sequence associated with it via a unique, indexed column?
$SQL = "SELECT a.attname, i.indisprimary,
substring(d.adsrc for 128) AS def\n".
"FROM ${DBD::Pg::dr::CATALOG}pg_index i,
${DBD::Pg::dr::CATALOG}pg_attribute a, ${DBD::Pg::dr::CATALOG}pg_attrdef
d\n ".