summaryrefslogtreecommitdiffstats
path: root/apps/rehash.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2020-01-04 15:54:53 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2020-03-21 18:46:36 +0100
commit7e06a6758bef584deabc9cb4b0d21b3e664b25c9 (patch)
tree8c0c5b3fbc427eb8f8b82570d3f88a1fa7032b3b /apps/rehash.c
parentd3b2f8760a56da3e70c30e5614181f3798e4ad54 (diff)
Fix error handling in x509v3_cache_extensions and related functions
Basically we use EXFLAG_INVALID for all kinds of out of memory and all kinds of parse errors in x509v3_cache_extensions. [extended tests] Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10755)
Diffstat (limited to 'apps/rehash.c')
-rw-r--r--apps/rehash.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/rehash.c b/apps/rehash.c
index de54064244..e67b27fd15 100644
--- a/apps/rehash.c
+++ b/apps/rehash.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@@ -274,11 +274,19 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h)
if (x->x509 != NULL) {
type = TYPE_CERT;
name = X509_get_subject_name(x->x509);
- X509_digest(x->x509, evpmd, digest, NULL);
+ if (!X509_digest(x->x509, evpmd, digest, NULL)) {
+ BIO_printf(bio_err, "out of memory\n");
+ ++errs;
+ goto end;
+ }
} else if (x->crl != NULL) {
type = TYPE_CRL;
name = X509_CRL_get_issuer(x->crl);
- X509_CRL_digest(x->crl, evpmd, digest, NULL);
+ if (!X509_CRL_digest(x->crl, evpmd, digest, NULL)) {
+ BIO_printf(bio_err, "out of memory\n");
+ ++errs;
+ goto end;
+ }
} else {
++errs;
goto end;