|
1 | 1 | /* |
2 | | - * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. |
| 2 | + * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. |
3 | 3 | * |
4 | 4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | 5 | * this file except in compliance with the License. You can obtain a copy |
@@ -74,22 +74,28 @@ int verify_callback(int ok, X509_STORE_CTX *ctx) |
74 | 74 | } |
75 | 75 | switch (err) { |
76 | 76 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: |
77 | | - BIO_puts(bio_err, "issuer= "); |
78 | | - X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert), |
79 | | - 0, get_nameopt()); |
80 | | - BIO_puts(bio_err, "\n"); |
| 77 | + if (err_cert != NULL) { |
| 78 | + BIO_puts(bio_err, "issuer= "); |
| 79 | + X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert), |
| 80 | + 0, get_nameopt()); |
| 81 | + BIO_puts(bio_err, "\n"); |
| 82 | + } |
81 | 83 | break; |
82 | 84 | case X509_V_ERR_CERT_NOT_YET_VALID: |
83 | 85 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: |
84 | | - BIO_printf(bio_err, "notBefore="); |
85 | | - ASN1_TIME_print(bio_err, X509_get0_notBefore(err_cert)); |
86 | | - BIO_printf(bio_err, "\n"); |
| 86 | + if (err_cert != NULL) { |
| 87 | + BIO_printf(bio_err, "notBefore="); |
| 88 | + ASN1_TIME_print(bio_err, X509_get0_notBefore(err_cert)); |
| 89 | + BIO_printf(bio_err, "\n"); |
| 90 | + } |
87 | 91 | break; |
88 | 92 | case X509_V_ERR_CERT_HAS_EXPIRED: |
89 | 93 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: |
90 | | - BIO_printf(bio_err, "notAfter="); |
91 | | - ASN1_TIME_print(bio_err, X509_get0_notAfter(err_cert)); |
92 | | - BIO_printf(bio_err, "\n"); |
| 94 | + if (err_cert != NULL) { |
| 95 | + BIO_printf(bio_err, "notAfter="); |
| 96 | + ASN1_TIME_print(bio_err, X509_get0_notAfter(err_cert)); |
| 97 | + BIO_printf(bio_err, "\n"); |
| 98 | + } |
93 | 99 | break; |
94 | 100 | case X509_V_ERR_NO_EXPLICIT_POLICY: |
95 | 101 | if (!verify_args.quiet) |
|
0 commit comments