diff options
author | Benjamin Kaduk <bkaduk@akamai.com> | 2016-03-08 15:53:49 -0600 |
---|---|---|
committer | Rich Salz <rsalz@akamai.com> | 2016-03-09 20:52:19 -0500 |
commit | 80e8fdbe793c8861411e9f49ea290847fa99f4c7 (patch) | |
tree | 2856805e021067a81c4b577ba428ef7564a544b7 /crypto/ct/ct_prn.c | |
parent | b805b4440dbda5444da2426c98ccd40f93d8cfa5 (diff) |
CT: check some GeneralizedTime return values
Some of the ASN.1 routines for the GeneralizedTime type can return
errors; check for these and do not continue past failure, so as
to appease coverity.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/ct/ct_prn.c')
-rw-r--r-- | crypto/ct/ct_prn.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/ct/ct_prn.c b/crypto/ct/ct_prn.c index bb669d577a..c2e11b1e24 100644 --- a/crypto/ct/ct_prn.c +++ b/crypto/ct/ct_prn.c @@ -80,6 +80,8 @@ static void timestamp_print(uint64_t timestamp, BIO *out) ASN1_GENERALIZEDTIME *gen = ASN1_GENERALIZEDTIME_new(); char genstr[20]; + if (gen == NULL) + return; ASN1_GENERALIZEDTIME_adj(gen, (time_t)0, (int)(timestamp / 86400000), (timestamp % 86400000) / 1000); @@ -89,8 +91,8 @@ static void timestamp_print(uint64_t timestamp, BIO *out) */ BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ", ASN1_STRING_data(gen), (unsigned int)(timestamp % 1000)); - ASN1_GENERALIZEDTIME_set_string(gen, genstr); - ASN1_GENERALIZEDTIME_print(out, gen); + if (ASN1_GENERALIZEDTIME_set_string(gen, genstr)) + ASN1_GENERALIZEDTIME_print(out, gen); ASN1_GENERALIZEDTIME_free(gen); } |