From 29b9b2b699cc4ed27e637a90404a77806cc20e32 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Tue, 1 Nov 2022 16:08:14 +0000 Subject: [PATCH] Fix zeroization at NULL pointer Signed-off-by: Dave Rodgman --- library/ssl_tls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index a49f774ed1..3c91b45139 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -5635,7 +5635,9 @@ static int tls_prf_generic( mbedtls_md_type_t md_type, exit: mbedtls_md_free( &md_ctx ); - mbedtls_platform_zeroize( tmp, tmp_len ); + if ( tmp != NULL ) + mbedtls_platform_zeroize( tmp, tmp_len ); + mbedtls_platform_zeroize( h_i, sizeof( h_i ) ); mbedtls_free( tmp );