From 34788ce8c1d08500631f55764cc2247b9c7cfd2b Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Sat, 25 Nov 2017 18:45:46 +0100 Subject: [PATCH] Ensure SelectLimit $nrows and`$offset parameters are integers The same is done (at least for `$nrows`) in the `SelectLimit` method of `Adodb/adodb.inc.php`. This lowers the risk of SQL injection. Fixes #311 (cherry picked from commit 7d43989dc95fd00fcf3ba73e08fdaf56ffa4f3e5) --- drivers/adodb-pdo_mysql.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/adodb-pdo_mysql.inc.php b/drivers/adodb-pdo_mysql.inc.php index b1f95f207..6e935db90 100644 --- a/drivers/adodb-pdo_mysql.inc.php +++ b/drivers/adodb-pdo_mysql.inc.php @@ -201,6 +201,8 @@ function SelectDB($dbName) // parameters use PostgreSQL convention, not MySQL function SelectLimit($sql, $nrows=-1, $offset=-1, $inputarr=false, $secs=0) { + $nrows = (int) $nrows; + $offset = (int) $offset; $offsetStr =($offset>=0) ? "$offset," : ''; // jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220 if ($nrows < 0) {