diff options
author | Pauli <paul.dale@oracle.com> | 2019-07-08 13:39:20 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2019-07-08 13:39:20 +1000 |
commit | 04151456b9d896a7825a5ac77c0310c97fa5f650 (patch) | |
tree | bcee8c5387a8703a7470acb3f16625c7503889cf /crypto/x509/t_req.c | |
parent | d9b6a51e926bfd1f86eac9de5dcbc28541fcf99f (diff) |
Avoid NULL pointer dereference.
[manual merge from #9059 to 1.1.0]
Fixes: #9043
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/9322)
Diffstat (limited to 'crypto/x509/t_req.c')
-rw-r--r-- | crypto/x509/t_req.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/x509/t_req.c b/crypto/x509/t_req.c index 77ce810835..3207dfaccc 100644 --- a/crypto/x509/t_req.c +++ b/crypto/x509/t_req.c @@ -125,6 +125,10 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, if ((j = i2a_ASN1_OBJECT(bp, aobj)) > 0) { ii = 0; count = X509_ATTRIBUTE_count(a); + if (count == 0) { + X509err(X509_F_X509_REQ_PRINT_EX, X509_R_INVALID_ATTRIBUTES); + return 0; + } get_next: at = X509_ATTRIBUTE_get0_type(a, ii); type = at->type; |