Initialize hash_len before using it

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-12-13 14:38:40 +01:00
parent 36d33f37b6
commit a4174312da

View file

@ -2874,7 +2874,7 @@ int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl )
int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl ) int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl )
{ {
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned int hash_len; unsigned int hash_len = 12;
unsigned char buf[SSL_MAX_HASH_LEN]; unsigned char buf[SSL_MAX_HASH_LEN];
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse finished" ) ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse finished" ) );
@ -2896,8 +2896,6 @@ int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl )
goto exit; goto exit;
} }
hash_len = 12;
if( ssl->in_msg[0] != MBEDTLS_SSL_HS_FINISHED ) if( ssl->in_msg[0] != MBEDTLS_SSL_HS_FINISHED )
{ {
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,