From 3bf41c35377956b8317522621fd4269a7976fb1c Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 2 Mar 2020 19:01:30 +0100 Subject: [PATCH] Fixed openssl build issue --- src/ssl/SSLManager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ssl/SSLManager.cpp b/src/ssl/SSLManager.cpp index 484dd8f..85c55c4 100644 --- a/src/ssl/SSLManager.cpp +++ b/src/ssl/SSLManager.cpp @@ -340,11 +340,11 @@ std::shared_ptr SSLManager::loadContext(std::string &rawKey, std::st #ifdef CRYPTO_BORINGSSL if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) SSL_ERROR("Failed to get mem contents: "); #else - BUF_MEM memory{}; - if(!BIO_get_mem_ptr(&*bio_private_key, &memory)) SSL_ERROR("Failed to get mem contents: "); + BUF_MEM* memory{nullptr}; + if(!BIO_get_mem_ptr(&*bio_private_key, &memory) || !memory) SSL_ERROR("Failed to get mem contents: "); - mem_ptr = (uint8_t*) memory.data; - length = memory.length; + mem_ptr = (uint8_t*) memory->data; + length = memory->length; #endif if(!mem_ptr || length < 0) SSL_ERROR("Could not get private key mem pointer/invalid length: "); rawKey.reserve(length); @@ -365,11 +365,11 @@ std::shared_ptr SSLManager::loadContext(std::string &rawKey, std::st #ifdef CRYPTO_BORINGSSL if(!BIO_mem_contents(&*bio_private_key, &mem_ptr, &length)) SSL_ERROR("Failed to get mem contents: "); #else - BUF_MEM memory{}; - if(!BIO_get_mem_ptr(&*bio_private_key, &memory)) SSL_ERROR("Failed to get mem contents: "); + BUF_MEM* memory{nullptr}; + if(!BIO_get_mem_ptr(&*bio_private_key, &memory) || !memory) SSL_ERROR("Failed to get mem contents: "); - mem_ptr = (uint8_t*) memory.data; - length = memory.length; + mem_ptr = (uint8_t*) memory->data; + length = memory->length; #endif if(!mem_ptr || length < 0) SSL_ERROR("Could not get cert bio mem pointer/invalid length: "); rawCert.reserve(length);