Skip to content

Commit

Permalink
Merge pull request #47914 from nextcloud/fix/noid/ldap-range-index-check
Browse files Browse the repository at this point in the history
fix(LDAP): check index before accessing it
  • Loading branch information
blizzz authored Sep 12, 2024
2 parents 15491d0 + c8fc2e8 commit a2ac1d8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,19 @@ public function extractAttributeValuesFromResult($result, $attribute) {
* @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;
}
}
}
Expand Down

0 comments on commit a2ac1d8

Please sign in to comment.