From d3bcc10d75f99dc5b14df326c4aaab12554f4f5d Mon Sep 17 00:00:00 2001 From: samuel40791765 Date: Thu, 13 Jun 2024 17:58:43 +0000 Subject: [PATCH] check more NULL cases --- crypto/x509/x509spki.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crypto/x509/x509spki.c b/crypto/x509/x509spki.c index 77fa8b857e..65021712e5 100644 --- a/crypto/x509/x509spki.c +++ b/crypto/x509/x509spki.c @@ -134,8 +134,10 @@ char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki) { } int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) { - if (out == NULL || spki == NULL || spki->spkac->pubkey == NULL || - spki->sig_algor == NULL || spki->signature == NULL) { + if (out == NULL || spki == NULL || spki->spkac == NULL || + spki->spkac->pubkey == NULL || spki->sig_algor == NULL || + spki->sig_algor->algorithm == NULL || spki->signature == NULL || + spki->signature->data == NULL) { OPENSSL_PUT_ERROR(X509, ERR_R_PASSED_NULL_PARAMETER); return 0; } @@ -155,7 +157,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) { } ASN1_IA5STRING *chal = spki->spkac->challenge; - if (chal->length != 0) { + if (chal != NULL && chal->length != 0) { BIO_printf(out, " Challenge String: %.*s\n", chal->length, chal->data); }