mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04: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 |      containing a client certificate | ||||||
|    * ssl_init() was leaving a dirty pointer in ssl_context if malloc of |    * ssl_init() was leaving a dirty pointer in ssl_context if malloc of | ||||||
|      out_ctr failed |      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 |    * Fix typo in rsa_copy() that impacted PKCS#1 v2 contexts | ||||||
| 
 | 
 | ||||||
| = PolarSSL 1.3.4 released on 2014-01-27 | = 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_negotiate = | ||||||
|             (ssl_transform *) polarssl_malloc( sizeof(ssl_transform) ); |             (ssl_transform *) polarssl_malloc( sizeof(ssl_transform) ); | ||||||
|  | 
 | ||||||
|  |         if( ssl->transform_negotiate != NULL ) | ||||||
|  |             memset( ssl->transform_negotiate, 0, sizeof(ssl_transform) ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if( ssl->session_negotiate ) |     if( ssl->session_negotiate ) | ||||||
| @ -3326,6 +3329,9 @@ static int ssl_handshake_init( ssl_context *ssl ) | |||||||
|     { |     { | ||||||
|         ssl->session_negotiate = |         ssl->session_negotiate = | ||||||
|             (ssl_session *) polarssl_malloc( sizeof(ssl_session) ); |             (ssl_session *) polarssl_malloc( sizeof(ssl_session) ); | ||||||
|  | 
 | ||||||
|  |         if( ssl->session_negotiate != NULL ) | ||||||
|  |             memset( ssl->session_negotiate, 0, sizeof(ssl_session) ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if( ssl->handshake ) |     if( ssl->handshake ) | ||||||
| @ -3334,6 +3340,9 @@ static int ssl_handshake_init( ssl_context *ssl ) | |||||||
|     { |     { | ||||||
|         ssl->handshake = (ssl_handshake_params *) |         ssl->handshake = (ssl_handshake_params *) | ||||||
|             polarssl_malloc( sizeof(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 || |     if( ssl->handshake == NULL || | ||||||
| @ -3344,10 +3353,6 @@ static int ssl_handshake_init( ssl_context *ssl ) | |||||||
|         return( POLARSSL_ERR_SSL_MALLOC_FAILED ); |         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) || \ | #if defined(POLARSSL_SSL_PROTO_SSL3) || defined(POLARSSL_SSL_PROTO_TLS1) || \ | ||||||
|     defined(POLARSSL_SSL_PROTO_TLS1_1) |     defined(POLARSSL_SSL_PROTO_TLS1_1) | ||||||
|      md5_starts( &ssl->handshake->fin_md5 ); |      md5_starts( &ssl->handshake->fin_md5 ); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Paul Bakker
						Paul Bakker