[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Mon May 9 16:10:35 UTC 2016


The branch master has been updated
       via  3105d695358d86c0f2a404b2b74a1870b941ce5e (commit)
      from  2e66d3d674d3a54593e0cbb4ff1f6039fd965d66 (commit)


- Log -----------------------------------------------------------------
commit 3105d695358d86c0f2a404b2b74a1870b941ce5e
Author: Matt Caswell <matt at openssl.org>
Date:   Mon May 9 15:04:11 2016 +0100

    Fix BIO_eof() for BIO pairs
    
    BIO_eof() was always returning true when using a BIO pair. It should only
    be true if the peer BIO is empty and has been shutdown.
    
    RT#1215
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>

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

Summary of changes:
 crypto/bio/bss_bio.c     | 15 +++++++--------
 doc/crypto/BIO_s_bio.pod |  3 +++
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c
index 2991c3a..820cf8c 100644
--- a/crypto/bio/bss_bio.c
+++ b/crypto/bio/bss_bio.c
@@ -627,16 +627,15 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
         break;
 
     case BIO_CTRL_EOF:
-        {
-            BIO *other_bio = ptr;
-
-            if (other_bio) {
-                struct bio_bio_st *other_b = other_bio->ptr;
+        if (b->peer != NULL) {
+            struct bio_bio_st *peer_b = b->peer->ptr;
 
-                assert(other_b != NULL);
-                ret = other_b->len == 0 && other_b->closed;
-            } else
+            if (peer_b->len == 0 && peer_b->closed)
                 ret = 1;
+            else
+                ret = 0;
+        } else {
+            ret = 1;
         }
         break;
 
diff --git a/doc/crypto/BIO_s_bio.pod b/doc/crypto/BIO_s_bio.pod
index 438b5dd..e6d5c49 100644
--- a/doc/crypto/BIO_s_bio.pod
+++ b/doc/crypto/BIO_s_bio.pod
@@ -120,6 +120,9 @@ the application then waits for data to be available on the underlying transport
 before flushing the write buffer it will never succeed because the request was
 never sent!
 
+BIO_eof() is true if no data is in the peer BIO and the peer BIO has been
+shutdown.
+
 =head1 RETURN VALUES
 
 BIO_new_bio_pair() returns 1 on success, with the new BIOs available in


More information about the openssl-commits mailing list