]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(LDAP): check index before accessing it 47914/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 12 Sep 2024 08:38:46 +0000 (10:38 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 12 Sep 2024 09:18:18 +0000 (11:18 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/user_ldap/lib/Access.php

index 66d1e7d6c141417846c88e73659691d5c40ab11d..864c85a8cf0b25304b2a7133cb8f8cd4795d60af 100644 (file)
@@ -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;
                                }
                        }
                }