diff options
author | Matt Caswell <matt@openssl.org> | 2016-05-09 15:04:11 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-09 17:05:16 +0100 |
commit | 3105d695358d86c0f2a404b2b74a1870b941ce5e (patch) | |
tree | 73bbb09087b492e2a165e686b25a6044e2a1396c /crypto/bio | |
parent | 2e66d3d674d3a54593e0cbb4ff1f6039fd965d66 (diff) |
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@openssl.org>
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bss_bio.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c index 2991c3afed..820cf8cf6a 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; |