diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-12 11:10:47 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-17 13:48:04 +0000 |
commit | f2e95a02b114d824905a5e2642287e060270515c (patch) | |
tree | 579ea2d232f3f2009e64e2f5afc3fd346b974f6a /apps/ca.c | |
parent | 912c8c92b5e703b19a6508de15b229e9fe788656 (diff) |
Add malloc failure checks
Add some missing checks for memory allocation failures in ca app.
Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit a561bfe944c0beba73551731cb98af70dfee3549)
Diffstat (limited to 'apps/ca.c')
-rw-r--r-- | apps/ca.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -2821,6 +2821,11 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME *comp_time = NULL; tmp = BUF_strdup(str); + if(!tmp) { + BIO_printf(bio_err, "memory allocation failure\n"); + goto err; + } + p = strchr(tmp, ','); rtime_str = tmp; @@ -2838,6 +2843,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, if (prevtm) { *prevtm = ASN1_UTCTIME_new(); + if(!*prevtm) { + BIO_printf(bio_err, "memory allocation failure\n"); + goto err; + } if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) { BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str); goto err; @@ -2878,6 +2887,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, goto err; } comp_time = ASN1_GENERALIZEDTIME_new(); + if(!comp_time) { + BIO_printf(bio_err, "memory allocation failure\n"); + goto err; + } if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str)) { BIO_printf(bio_err, "invalid compromised time %s\n", arg_str); goto err; |