diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 19523bac92..058173c4aa 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -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 )