summaryrefslogtreecommitdiffstats
path: root/etc/inc/certs.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-05-11 16:12:29 -0400
committerjim-p <jimp@pfsense.org>2011-05-11 16:12:29 -0400
commit4bc2c6766e2782aad63120f2c5f77d306fb7609f (patch)
tree5be106361eb3647871c5a75f7c9f167a09157ac2 /etc/inc/certs.inc
parent728003c8934207a87e7c32a0aa2caecccf3ff8c1 (diff)
downloadpfsense-4bc2c6766e2782aad63120f2c5f77d306fb7609f.zip
pfsense-4bc2c6766e2782aad63120f2c5f77d306fb7609f.tar.gz
Test for array/size before foreach
Diffstat (limited to 'etc/inc/certs.inc')
-rw-r--r--etc/inc/certs.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc
index e62719c..357ac05 100644
--- a/etc/inc/certs.inc
+++ b/etc/inc/certs.inc
@@ -485,8 +485,10 @@ function crl_update(& $crl) {
$ca_str_crt = base64_decode($ca['crt']);
$ca_str_key = base64_decode($ca['prv']);
$crl_res = openssl_crl_new($ca_str_crt, $crl['serial'], $crl['lifetime']);
- foreach ($crl['cert'] as $cert) {
- openssl_crl_revoke_cert($crl_res, base64_decode($cert["crt"]), $cert["revoke_time"], $cert["reason"]);
+ if (is_array($crl['cert']) && (count($crl['cert']) > 0)) {
+ foreach ($crl['cert'] as $cert) {
+ openssl_crl_revoke_cert($crl_res, base64_decode($cert["crt"]), $cert["revoke_time"], $cert["reason"]);
+ }
}
openssl_crl_export($crl_res, $crl_text, $ca_str_key);
$crl['text'] = base64_encode($crl_text);
OpenPOWER on IntegriCloud