1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-23 15:01:00 +03:00

Fix the wrong variable being used for TLS record size checks

Fix an issue whereby a variable was used to check the size of incoming
TLS records against the configured maximum prior to it being set to the
right value.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott
2022-06-10 14:11:31 +01:00
parent 492ece7b54
commit 24ed2caaff
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Bugfix
* Fix record sizes larger than 16384 being sometimes accepted despite being
non-compliant. This could not lead to a buffer overflow. In particular,
application data size was already checked correctly.

View File

@ -3908,7 +3908,7 @@ static int ssl_prepare_record_content( mbedtls_ssl_context *ssl,
/* Check actual (decrypted) record content length against
* configured maximum. */
if( ssl->in_msglen > MBEDTLS_SSL_IN_CONTENT_LEN )
if( rec->data_len > MBEDTLS_SSL_IN_CONTENT_LEN )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad message length" ) );
return( MBEDTLS_ERR_SSL_INVALID_RECORD );