From 98ec442b37027098d9d92e4b9adda99eccc11992 Mon Sep 17 00:00:00 2001 From: Kareem Date: Fri, 27 May 2022 10:57:23 -0700 Subject: [PATCH] Confirm ssl->hsHashes is not NULL before attempting to dereference it. --- src/internal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal.c b/src/internal.c index 8e559a728..359d2fcdf 100644 --- a/src/internal.c +++ b/src/internal.c @@ -14341,7 +14341,7 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, #endif { ssl->options.cacheMessages = 0; - if (ssl->hsHashes->messages != NULL) { + if ((ssl->hsHashes != NULL) && (ssl->hsHashes->messages != NULL)) { XFREE(ssl->hsHashes->messages, ssl->heap, DYNAMIC_TYPE_HASHES); ssl->hsHashes->messages = NULL; @@ -14427,7 +14427,7 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, #endif { ssl->options.cacheMessages = 0; - if (ssl->hsHashes->messages != NULL) { + if ((ssl->hsHashes != NULL) && (ssl->hsHashes->messages != NULL)) { XFREE(ssl->hsHashes->messages, ssl->heap, DYNAMIC_TYPE_HASHES); ssl->hsHashes->messages = NULL; }