diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-26 23:19:21 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-26 23:19:21 +0000 |
commit | 873564ea9ce6e9ec5a07bc2a42ffd54e34b97c72 (patch) | |
tree | 5598e9250682bf1d53bc60114bf890b2160ad74c | |
parent | 06624df622e6278d2f220ed538db8df0eabc5fe1 (diff) | |
download | tor-873564ea9ce6e9ec5a07bc2a42ffd54e34b97c72.tar tor-873564ea9ce6e9ec5a07bc2a42ffd54e34b97c72.tar.gz |
Some versions of openssl have an SSL_pending function that erroneously
returns bytes when there is a non-application record pending.
I have no idea when/why this would even happen, but let's catch it and
make sure tor_tls_get_pending_bytes stays correct.
svn:r1727
-rw-r--r-- | src/common/tortls.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 738556d24..e46b1a909 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -603,7 +603,14 @@ int tor_tls_get_pending_bytes(tor_tls *tls) { tor_assert(tls); +#if OPENSSL_VERSION_NUMBER < 0x0090700fl + if (tls->ssl->rstate == SSL_ST_READ_BODY) + return 0; + if (tls->ssl->s3->rrec.type != SSL3_RT_APPLICATION_DATA) + return 0; +#endif return SSL_pending(tls->ssl); + } /* Return the number of bytes read across the underlying socket. */ |