Skip to content

Commit

Permalink
Merge pull request #1 from mybuilder/fix-security-issue
Browse files Browse the repository at this point in the history
Fix potential SQL injection issue
  • Loading branch information
gavinlove authored Feb 21, 2018
2 parents b99e1c0 + 181de40 commit c393e15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions runtime/lib/adapter/DBPostgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ public function getTimeFormatter()
*/
public function applyLimit(&$sql, $offset, $limit)
{
$offset = (int) $offset;
$limit = (int) $limit;

if ($limit > 0) {
$sql .= " LIMIT ".$limit;
}
Expand Down
3 changes: 1 addition & 2 deletions runtime/lib/query/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,7 @@ public function isSingleRecord()
*/
public function setLimit($limit)
{
// TODO: do we enforce int here? 32bit issue if we do
$this->limit = $limit;
$this->limit = (int) $limit;

return $this;
}
Expand Down

0 comments on commit c393e15

Please sign in to comment.