aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2024-09-12 12:53:44 +0200
committerGitHub <noreply@github.com>2024-09-12 12:53:44 +0200
commita2ac1d8be05a482aa649d902b47b4ed688f21f8d (patch)
tree675ba57163217d325190b21cc99f9b19036d439e
parent15491d086684dbb2f00c2854761870ad22e091ac (diff)
parentc8fc2e8a6760678d8b4a721a7e8c8078c0d67955 (diff)
downloadnextcloud-server-a2ac1d8be05a482aa649d902b47b4ed688f21f8d.tar.gz
nextcloud-server-a2ac1d8be05a482aa649d902b47b4ed688f21f8d.zip
Merge pull request #47914 from nextcloud/fix/noid/ldap-range-index-check
fix(LDAP): check index before accessing it
-rw-r--r--apps/user_ldap/lib/Access.php7
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;
}
}
}