mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Fix overread when verifying SERVER_HELLO in DTLS
This commit is contained in:
		
							parent
							
								
									93012e8bce
								
							
						
					
					
						commit
						5a87c9375d
					
				@ -29,6 +29,8 @@ Bugfix
 | 
			
		||||
     a contribution from Tobias Tangemann. #541
 | 
			
		||||
   * Fixed cert_app sample program for debug output and for use when no root
 | 
			
		||||
     certificates are provided.
 | 
			
		||||
   * Fix potential byte overread when verifying malformed SERVER_HELLO in
 | 
			
		||||
     ssl_parse_hello_verify_request() for DTLS. Found by Guido Vranken.
 | 
			
		||||
 | 
			
		||||
Changes
 | 
			
		||||
   * Extended test coverage of special cases, and added new timing test suite.
 | 
			
		||||
 | 
			
		||||
@ -1355,6 +1355,15 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
 | 
			
		||||
    cookie_len = *p++;
 | 
			
		||||
    MBEDTLS_SSL_DEBUG_BUF( 3, "cookie", p, cookie_len );
 | 
			
		||||
 | 
			
		||||
    if( ( ssl->in_msg + ssl->in_msglen ) - p < cookie_len )
 | 
			
		||||
    {
 | 
			
		||||
        MBEDTLS_SSL_DEBUG_MSG( 1,
 | 
			
		||||
            ( "cookie length does not match incoming message size" ) );
 | 
			
		||||
        mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
 | 
			
		||||
                                    MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
 | 
			
		||||
        return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    mbedtls_free( ssl->handshake->verify_cookie );
 | 
			
		||||
 | 
			
		||||
    ssl->handshake->verify_cookie = mbedtls_calloc( 1, cookie_len );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user