summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-09-23 10:59:58 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2017-09-24 10:29:50 +0000
commitf217b5e6f21056be4d7cbdf552c86d40007dc2b0 (patch)
tree32c0bf811c6f69bdd7d97bcd40bbab3bfbde7184
parent093ee84661df6ade4dee493e45055f6fdcb706fe (diff)
downloadgnutls-f217b5e6f21056be4d7cbdf552c86d40007dc2b0.tar.gz
ocsptool: check chain size on verification
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--src/ocsptool.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ocsptool.c b/src/ocsptool.c
index c0ae7ad6fe..1338d6122b 100644
--- a/src/ocsptool.c
+++ b/src/ocsptool.c
@@ -478,8 +478,12 @@ static void verify_response(gnutls_datum_t *nonce)
if (HAVE_OPT(LOAD_CHAIN)) {
chain_size = load_chain(chain);
+ if (chain_size < 1) {
+ fprintf(stderr, "Empty chain found; cannot verify\n");
+ app_exit(1);
+ }
- if (chain_size <= 1)
+ if (chain_size == 1)
signer = chain[0];
else
signer = chain[1];