diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-10-28 13:59:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-28 13:59:09 +0100 |
commit | f763219f195ae4b7161ffc1b8204172148747767 (patch) | |
tree | d31cbdd08b84d83ab010e35ff4c3b8edf98b9bf1 /lib | |
parent | 70500e25ad3cf42c3ecfef016d5fee06a3b3dfd5 (diff) | |
parent | dd185e383d74c3c6e6c186b3f41257a47656260f (diff) | |
download | nextcloud-server-f763219f195ae4b7161ffc1b8204172148747767.tar.gz nextcloud-server-f763219f195ae4b7161ffc1b8204172148747767.zip |
Merge pull request #17712 from nextcloud/enh/limit_hardening/database/user
Make sure limit is never negative
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/Database.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 3db96fa02e2..23dbe8c2334 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -259,6 +259,8 @@ class Database extends ABackend * @return array an array of all displayNames (value) and the corresponding uids (key) */ public function getDisplayNames($search = '', $limit = null, $offset = null) { + $limit = $this->fixLimit($limit); + $this->fixDI(); $query = $this->dbConn->getQueryBuilder(); @@ -380,6 +382,8 @@ class Database extends ABackend * @return string[] an array of all uids */ public function getUsers($search = '', $limit = null, $offset = null) { + $limit = $this->fixLimit($limit); + $users = $this->getDisplayNames($search, $limit, $offset); $userIds = array_map(function ($uid) { return (string)$uid; @@ -485,5 +489,11 @@ class Database extends ABackend return $this->cache[$uid]['uid']; } + private function fixLimit($limit) { + if (is_int($limit) && $limit >= 0) { + return $limit; + } + return null; + } } |