mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
System: Trust: Authorities - prevent recusrion loop when ca's are cross referencing eachother.
Although this is highly uncommon, it's very annoying when the certificate path leads to an "Fatat error: Allowed memory size exhausted...". If we do end in a loop (e.g. same ca already in the path), exit the calculation and return what we found sofar.
This commit is contained in:
parent
d240c8b0fa
commit
5629911558
@ -107,6 +107,9 @@ function ca_chain_array(&$cert)
|
||||
$crt = false;
|
||||
}
|
||||
if ($crt) {
|
||||
if (in_array($crt, $chain)) {
|
||||
break; /* exit endless loop */
|
||||
}
|
||||
$chain[] = $crt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -596,7 +596,11 @@ class Store
|
||||
{
|
||||
$chain = [];
|
||||
while (($item = self::getCA(!isset($item) ? $caref : $item->caref)) != null) {
|
||||
$chain[] = base64_decode((string)$item->crt);
|
||||
$data = base64_decode((string)$item->crt);
|
||||
if (in_array($data, $chain)) {
|
||||
break; /* exit endless loop */
|
||||
}
|
||||
$chain[] = $data;
|
||||
}
|
||||
return implode("\n", $chain);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user