diff --git a/src/etc/inc/certs.inc b/src/etc/inc/certs.inc index fef4d987a..869f341af 100644 --- a/src/etc/inc/certs.inc +++ b/src/etc/inc/certs.inc @@ -107,6 +107,9 @@ function ca_chain_array(&$cert) $crt = false; } if ($crt) { + if (in_array($crt, $chain)) { + break; /* exit endless loop */ + } $chain[] = $crt; } } diff --git a/src/opnsense/mvc/app/library/OPNsense/Trust/Store.php b/src/opnsense/mvc/app/library/OPNsense/Trust/Store.php index 1827b0e8b..48238c3ee 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Trust/Store.php +++ b/src/opnsense/mvc/app/library/OPNsense/Trust/Store.php @@ -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); }