diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-09-12 10:38:46 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-09-12 11:18:18 +0200 |
commit | c8fc2e8a6760678d8b4a721a7e8c8078c0d67955 (patch) | |
tree | 8fd235e27e606df2f203a6f463611bf7c04ba3a5 | |
parent | 8feef455068533c18f7ab25e2274187733217a5e (diff) | |
download | nextcloud-server-c8fc2e8a6760678d8b4a721a7e8c8078c0d67955.tar.gz nextcloud-server-c8fc2e8a6760678d8b4a721a7e8c8078c0d67955.zip |
fix(LDAP): check index before accessing it
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r-- | apps/user_ldap/lib/Access.php | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 66d1e7d6c14..864c85a8cf0 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -305,20 +305,19 @@ class Access extends LDAPUtility { * @return array If a range was detected with keys 'values', 'attributeName', * 'attributeFull' and 'rangeHigh', otherwise empty. */ - public function extractRangeData($result, $attribute) { + public function extractRangeData(array $result, string $attribute): array { $keys = array_keys($result); foreach ($keys as $key) { if ($key !== $attribute && str_starts_with((string)$key, $attribute)) { $queryData = explode(';', (string)$key); - if (str_starts_with($queryData[1], 'range=')) { + if (isset($queryData[1]) && str_starts_with($queryData[1], 'range=')) { $high = substr($queryData[1], 1 + strpos($queryData[1], '-')); - $data = [ + return [ 'values' => $result[$key], 'attributeName' => $queryData[0], 'attributeFull' => $key, 'rangeHigh' => $high, ]; - return $data; } } } |