PR: 2090
Submitted by: Martin Kaiser <lists@kaiser.cx>, Stephen Henson Approved by: steve@openssl.org Improve error checking in asn1_gen.c
This commit is contained in:
parent
ec4346f6f9
commit
bf6eea6536
@ -227,6 +227,8 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
|
|||||||
/* Allocate buffer for new encoding */
|
/* Allocate buffer for new encoding */
|
||||||
|
|
||||||
new_der = OPENSSL_malloc(len);
|
new_der = OPENSSL_malloc(len);
|
||||||
|
if (!new_der)
|
||||||
|
goto err;
|
||||||
|
|
||||||
/* Generate tagged encoding */
|
/* Generate tagged encoding */
|
||||||
|
|
||||||
@ -452,6 +454,8 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
|||||||
int derlen;
|
int derlen;
|
||||||
int i;
|
int i;
|
||||||
sk = sk_ASN1_TYPE_new_null();
|
sk = sk_ASN1_TYPE_new_null();
|
||||||
|
if (!sk)
|
||||||
|
goto bad;
|
||||||
if (section)
|
if (section)
|
||||||
{
|
{
|
||||||
if (!cnf)
|
if (!cnf)
|
||||||
@ -464,7 +468,8 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
|||||||
ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
||||||
if (!typ)
|
if (!typ)
|
||||||
goto bad;
|
goto bad;
|
||||||
sk_ASN1_TYPE_push(sk, typ);
|
if (!sk_ASN1_TYPE_push(sk, typ))
|
||||||
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,6 +480,9 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
|||||||
else
|
else
|
||||||
derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
|
derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
|
||||||
|
|
||||||
|
if (derlen < 0)
|
||||||
|
goto bad;
|
||||||
|
|
||||||
if (!(ret = ASN1_TYPE_new()))
|
if (!(ret = ASN1_TYPE_new()))
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user