Commit 77f4f39e authored by Paul Bakker's avatar Paul Bakker
Browse files

Make sure no random pointer occur during failed malloc()'s

parent db1f0598
......@@ -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 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment