Return from ssl_load_buffered_record early if no record is buffered

This commit is contained in:
Hanno Becker 2018-08-20 11:19:05 +01:00
parent caf8741891
commit 4cb782d2f6

View file

@ -4730,11 +4730,6 @@ static int ssl_load_buffered_record( mbedtls_ssl_context *ssl )
if( hs == NULL )
return( 0 );
/* Only consider loading future records if the
* input buffer is empty. */
if( ssl_another_record_in_datagram( ssl ) == 1 )
return( 0 );
rec = hs->buffering.future_record.data;
rec_len = hs->buffering.future_record.len;
rec_epoch = hs->buffering.future_record.epoch;
@ -4742,6 +4737,11 @@ static int ssl_load_buffered_record( mbedtls_ssl_context *ssl )
if( rec == NULL )
return( 0 );
/* Only consider loading future records if the
* input buffer is empty. */
if( ssl_another_record_in_datagram( ssl ) == 1 )
return( 0 );
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> ssl_load_buffered_record" ) );
if( rec_epoch != ssl->in_epoch )