From 4cb782d2f67d186feef72e57c376f5831c20b0c8 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Mon, 20 Aug 2018 11:19:05 +0100 Subject: [PATCH] Return from ssl_load_buffered_record early if no record is buffered --- library/ssl_tls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 )