mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 07:04:17 +01:00
Set len var to 0 when buf is freed in ssl_tls.c
This commit is contained in:
parent
c17cc44ed9
commit
3d23146f62
@ -5870,13 +5870,19 @@ int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
if( conf->psk != NULL || conf->psk_identity != NULL )
|
||||
if( conf->psk != NULL )
|
||||
{
|
||||
mbedtls_zeroize( conf->psk, conf->psk_len );
|
||||
|
||||
mbedtls_free( conf->psk );
|
||||
mbedtls_free( conf->psk_identity );
|
||||
conf->psk = NULL;
|
||||
conf->psk_len = 0;
|
||||
}
|
||||
if( conf->psk_identity != NULL )
|
||||
{
|
||||
mbedtls_free( conf->psk_identity );
|
||||
conf->psk_identity = NULL;
|
||||
conf->psk_identity_len = 0;
|
||||
}
|
||||
|
||||
if( ( conf->psk = mbedtls_calloc( 1, psk_len ) ) == NULL ||
|
||||
@ -5911,6 +5917,7 @@ int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,
|
||||
{
|
||||
mbedtls_zeroize( ssl->handshake->psk, ssl->handshake->psk_len );
|
||||
mbedtls_free( ssl->handshake->psk );
|
||||
ssl->handshake->psk_len = 0;
|
||||
}
|
||||
|
||||
if( ( ssl->handshake->psk = mbedtls_calloc( 1, psk_len ) ) == NULL )
|
||||
|
Loading…
Reference in New Issue
Block a user