From 734a73dd35ba5c496cd5f8797bc9af3c1188a9d0 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 22 Oct 2021 11:17:41 -0700 Subject: [PATCH] Add missing null-check. Fix dead store. --- src/ssl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ssl.c b/src/ssl.c index 2454d54cf..2ddb6d573 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -20387,7 +20387,7 @@ int wolfSSL_X509_get_pubkey_buffer(WOLFSSL_X509* x509, return WOLFSSL_FATAL_ERROR; } - if (buf != NULL) { + if (buf != NULL && pubKeyX509 != NULL) { if (pubKeyX509Sz > *bufSz) { WOLFSSL_LEAVE("wolfSSL_X509_get_pubkey_buffer", BUFFER_E); return WOLFSSL_FATAL_ERROR; @@ -42858,6 +42858,8 @@ cleanup: #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) if (l == 0) WOLFSSL_ERROR(ASN_NO_PEM_HEADER); + #else + (void)l; #endif pemSz = (int)i; #ifdef WOLFSSL_CERT_REQ