diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-06-05 14:23:27 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-06-06 13:17:06 +0100 |
commit | 4336de0c6392d98c32bc27717173130d5e7389aa (patch) | |
tree | 130dad9af433cf54f652f03f9ab9174199d9864c /crypto/asn1/t_x509.c | |
parent | c0cf5b84dd32480965da7ff1e11d11a1ec9c4662 (diff) | |
download | openssl-4336de0c6392d98c32bc27717173130d5e7389aa.tar.gz |
Check ASN1_INTEGER_get for errors.
Check return value when calling ASN1_INTEGER_get to retrieve a certificate
serial number. If an error occurs (which will be caused by the value being
out of range) revert to hex dump of serial number.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/asn1/t_x509.c')
-rw-r--r-- | crypto/asn1/t_x509.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/asn1/t_x509.c b/crypto/asn1/t_x509.c index 377be399df..12a9ed4940 100644 --- a/crypto/asn1/t_x509.c +++ b/crypto/asn1/t_x509.c @@ -141,7 +141,13 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, bs = X509_get_serialNumber(x); if (bs->length <= (int)sizeof(long)) { - l = ASN1_INTEGER_get(bs); + ERR_set_mark(); + l = ASN1_INTEGER_get(bs); + ERR_pop_to_mark(); + } else { + l = -1; + } + if (l != -1) { if (bs->type == V_ASN1_NEG_INTEGER) { l = -l; neg = "-"; |