mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 11:35:44 +01:00
Make sure no random pointer occur during failed malloc()'s
This commit is contained in:
parent
db1f05985e
commit
77f4f39ea6
@ -56,6 +56,8 @@ Bugfix
|
||||
containing a client certificate
|
||||
* ssl_init() was leaving a dirty pointer in ssl_context if malloc of
|
||||
out_ctr failed
|
||||
* ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc
|
||||
of one of them failed
|
||||
* Fix typo in rsa_copy() that impacted PKCS#1 v2 contexts
|
||||
|
||||
= PolarSSL 1.3.4 released on 2014-01-27
|
||||
|
@ -3318,6 +3318,9 @@ static int ssl_handshake_init( ssl_context *ssl )
|
||||
{
|
||||
ssl->transform_negotiate =
|
||||
(ssl_transform *) polarssl_malloc( sizeof(ssl_transform) );
|
||||
|
||||
if( ssl->transform_negotiate != NULL )
|
||||
memset( ssl->transform_negotiate, 0, sizeof(ssl_transform) );
|
||||
}
|
||||
|
||||
if( ssl->session_negotiate )
|
||||
@ -3326,6 +3329,9 @@ static int ssl_handshake_init( ssl_context *ssl )
|
||||
{
|
||||
ssl->session_negotiate =
|
||||
(ssl_session *) polarssl_malloc( sizeof(ssl_session) );
|
||||
|
||||
if( ssl->session_negotiate != NULL )
|
||||
memset( ssl->session_negotiate, 0, sizeof(ssl_session) );
|
||||
}
|
||||
|
||||
if( ssl->handshake )
|
||||
@ -3334,6 +3340,9 @@ static int ssl_handshake_init( ssl_context *ssl )
|
||||
{
|
||||
ssl->handshake = (ssl_handshake_params *)
|
||||
polarssl_malloc( sizeof(ssl_handshake_params) );
|
||||
|
||||
if( ssl->handshake != NULL )
|
||||
memset( ssl->handshake, 0, sizeof(ssl_handshake_params) );
|
||||
}
|
||||
|
||||
if( ssl->handshake == NULL ||
|
||||
@ -3344,10 +3353,6 @@ static int ssl_handshake_init( ssl_context *ssl )
|
||||
return( POLARSSL_ERR_SSL_MALLOC_FAILED );
|
||||
}
|
||||
|
||||
memset( ssl->handshake, 0, sizeof(ssl_handshake_params) );
|
||||
memset( ssl->transform_negotiate, 0, sizeof(ssl_transform) );
|
||||
memset( ssl->session_negotiate, 0, sizeof(ssl_session) );
|
||||
|
||||
#if defined(POLARSSL_SSL_PROTO_SSL3) || defined(POLARSSL_SSL_PROTO_TLS1) || \
|
||||
defined(POLARSSL_SSL_PROTO_TLS1_1)
|
||||
md5_starts( &ssl->handshake->fin_md5 );
|
||||
|
Loading…
Reference in New Issue
Block a user