From 98ec442b37027098d9d92e4b9adda99eccc11992 Mon Sep 17 00:00:00 2001 From: Kareem Date: Fri, 27 May 2022 10:57:23 -0700 Subject: [PATCH 1/3] 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; } From 6e6c4500d6c0e06fc4930669f26465cefce68a05 Mon Sep 17 00:00:00 2001 From: Kareem Date: Fri, 27 May 2022 11:01:29 -0700 Subject: [PATCH 2/3] Fix comments in asn1.h to use ANSI C style. --- wolfssl/openssl/asn1.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfssl/openssl/asn1.h b/wolfssl/openssl/asn1.h index fc7345308..9eab1a255 100644 --- a/wolfssl/openssl/asn1.h +++ b/wolfssl/openssl/asn1.h @@ -164,7 +164,7 @@ WOLFSSL_API int wolfSSL_ASN1_item_i2d(const void *src, byte **dest, const WOLFSSL_ASN1_ITEM *tpl); /* Need function declaration otherwise compiler complains */ -// NOLINTBEGIN(readability-named-parameter) +/* NOLINTBEGIN(readability-named-parameter) */ #define IMPLEMENT_ASN1_FUNCTIONS(type) \ type *type##_new(void); \ type *type##_new(void){ \ @@ -179,7 +179,7 @@ WOLFSSL_API int wolfSSL_ASN1_item_i2d(const void *src, byte **dest, { \ return wolfSSL_ASN1_item_i2d(src, dest, &type##_template_data);\ } -// NOLINTEND(readability-named-parameter) +/* NOLINTEND(readability-named-parameter) */ #endif /* OPENSSL_ALL */ From e061bc23f4a35584ebc61b59ef7ef9d047e0f6c1 Mon Sep 17 00:00:00 2001 From: Kareem Date: Fri, 27 May 2022 13:05:56 -0700 Subject: [PATCH 3/3] Fix asn1.h NOLINT comments. --- wolfssl/openssl/asn1.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfssl/openssl/asn1.h b/wolfssl/openssl/asn1.h index 9eab1a255..ebcf4f2c3 100644 --- a/wolfssl/openssl/asn1.h +++ b/wolfssl/openssl/asn1.h @@ -164,7 +164,7 @@ WOLFSSL_API int wolfSSL_ASN1_item_i2d(const void *src, byte **dest, const WOLFSSL_ASN1_ITEM *tpl); /* Need function declaration otherwise compiler complains */ -/* NOLINTBEGIN(readability-named-parameter) */ +/* // NOLINTBEGIN(readability-named-parameter) */ #define IMPLEMENT_ASN1_FUNCTIONS(type) \ type *type##_new(void); \ type *type##_new(void){ \ @@ -179,7 +179,7 @@ WOLFSSL_API int wolfSSL_ASN1_item_i2d(const void *src, byte **dest, { \ return wolfSSL_ASN1_item_i2d(src, dest, &type##_template_data);\ } -/* NOLINTEND(readability-named-parameter) */ +/* // NOLINTEND(readability-named-parameter) */ #endif /* OPENSSL_ALL */