Fix potential double-free in mbedtls_ssl_conf_psk()

This commit is contained in:
Manuel Pégourié-Gonnard 2015-09-28 18:09:45 +02:00
parent f592e8eaf6
commit 24417f06fe
2 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,12 @@
mbed TLS ChangeLog (Sorted per branch, date) mbed TLS ChangeLog (Sorted per branch, date)
= mbed TLS 2.1.2 released 2015-??-??
Security
* Fix potential double-free if mbedtls_conf_psk() is called repeatedly on
the same mbedtls_ssl_config object and some memory allocations fail.
Found by Guido Vranken. Can not be forced remotely.
= mbed TLS 2.1.1 released 2015-09-17 = mbed TLS 2.1.1 released 2015-09-17
Security Security

View file

@ -5707,7 +5707,9 @@ int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
( conf->psk_identity = mbedtls_calloc( 1, psk_identity_len ) ) == NULL ) ( conf->psk_identity = mbedtls_calloc( 1, psk_identity_len ) ) == NULL )
{ {
mbedtls_free( conf->psk ); mbedtls_free( conf->psk );
mbedtls_free( conf->psk_identity );
conf->psk = NULL; conf->psk = NULL;
conf->psk_identity = NULL;
return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
} }