[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Tue Nov 7 11:13:27 UTC 2017


The branch master has been updated
       via  1c47d35a0380783b62004a7cb8058d34e082f8d5 (commit)
      from  018632ae986af33b2dddb2c1496bf91446d35abe (commit)


- Log -----------------------------------------------------------------
commit 1c47d35a0380783b62004a7cb8058d34e082f8d5
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Nov 6 16:52:06 2017 +0000

    Mark a zero length record as read
    
    If SSL_read() is called with a zero length buffer, and we read a zero length
    record then we should mark that record as read.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4685)

-----------------------------------------------------------------------

Summary of changes:
 ssl/record/rec_layer_s3.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c
index 980e5a4..d10b91b 100644
--- a/ssl/record/rec_layer_s3.c
+++ b/ssl/record/rec_layer_s3.c
@@ -1305,8 +1305,16 @@ int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
         if (recvd_type != NULL)
             *recvd_type = SSL3_RECORD_get_type(rr);
 
-        if (len == 0)
+        if (len == 0) {
+            /*
+             * Mark a zero length record as read. This ensures multiple calls to
+             * SSL_read() with a zero length buffer will eventually cause
+             * SSL_pending() to report data as being available.
+             */
+            if (SSL3_RECORD_get_length(rr) == 0)
+                SSL3_RECORD_set_read(rr);
             return 0;
+        }
 
         totalbytes = 0;
         do {


More information about the openssl-commits mailing list