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)
This commit is contained in:
parent
eadc81e7dd
commit
3f9117e161
13
apps/ca.c
13
apps/ca.c
@ -2803,6 +2803,11 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
|||||||
ASN1_GENERALIZEDTIME *comp_time = NULL;
|
ASN1_GENERALIZEDTIME *comp_time = NULL;
|
||||||
tmp = BUF_strdup(str);
|
tmp = BUF_strdup(str);
|
||||||
|
|
||||||
|
if(!tmp) {
|
||||||
|
BIO_printf(bio_err, "memory allocation failure\n");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
p = strchr(tmp, ',');
|
p = strchr(tmp, ',');
|
||||||
|
|
||||||
rtime_str = tmp;
|
rtime_str = tmp;
|
||||||
@ -2820,6 +2825,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
|||||||
|
|
||||||
if (prevtm) {
|
if (prevtm) {
|
||||||
*prevtm = ASN1_UTCTIME_new();
|
*prevtm = ASN1_UTCTIME_new();
|
||||||
|
if(!*prevtm) {
|
||||||
|
BIO_printf(bio_err, "memory allocation failure\n");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) {
|
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) {
|
||||||
BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str);
|
BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str);
|
||||||
goto err;
|
goto err;
|
||||||
@ -2860,6 +2869,10 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
comp_time = ASN1_GENERALIZEDTIME_new();
|
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)) {
|
if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str)) {
|
||||||
BIO_printf(bio_err, "invalid compromised time %s\n", arg_str);
|
BIO_printf(bio_err, "invalid compromised time %s\n", arg_str);
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user