summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDmitry Belyavskiy <beldmit@gmail.com>2019-07-08 20:14:50 +1000
committerPauli <paul.dale@oracle.com>2019-07-08 20:15:44 +1000
commita48cd0c5b9fef42321fc16ea6a40c30c0e1712d4 (patch)
tree75315556a349e970072f9d5df77d60c00dad4b1d /apps
parent7b031c206228ae1f48bdd9e271fc101f91f817e1 (diff)
Avoid NULL pointer dereference. Fixes #9043.
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9059) (cherry picked from commit 9fd6f7d1cd2a3c8e2bc69dcb8bde8406eb6c2623)
Diffstat (limited to 'apps')
-rw-r--r--apps/req.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/req.c b/apps/req.c
index 6fd28a2aba..6dd119be7a 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -881,9 +881,19 @@ int req_main(int argc, char **argv)
if (text) {
if (x509)
- X509_print_ex(out, x509ss, get_nameopt(), reqflag);
+ ret = X509_print_ex(out, x509ss, get_nameopt(), reqflag);
else
- X509_REQ_print_ex(out, req, get_nameopt(), reqflag);
+ ret = X509_REQ_print_ex(out, req, get_nameopt(), reqflag);
+
+ if (ret == 0) {
+ if (x509)
+ BIO_printf(bio_err, "Error printing certificate\n");
+ else
+ BIO_printf(bio_err, "Error printing certificate request\n");
+
+ ERR_print_errors(bio_err);
+ goto end;
+ }
}
if (subject) {