Double check that record expansion is as expected during decryption

This commit is contained in:
Hanno Becker 2018-08-07 14:30:18 +01:00 committed by Manuel Pégourié-Gonnard
parent a795323cd5
commit 93012fe8e8

View file

@ -4340,6 +4340,11 @@ static int ssl_prepare_record_content( mbedtls_ssl_context *ssl )
return( ret ); return( ret );
} }
if( ssl->in_iv + rec.data_offset != ssl->in_msg )
{
/* Should never happen */
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
ssl->in_msglen = rec.data_len; ssl->in_msglen = rec.data_len;
ssl->in_len[0] = (unsigned char)( rec.data_len >> 8 ); ssl->in_len[0] = (unsigned char)( rec.data_len >> 8 );