]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Some versions of openssl have an SSL_pending function that erroneously
authorNick Mathewson <nickm@torproject.org>
Mon, 26 Apr 2004 23:19:21 +0000 (23:19 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 26 Apr 2004 23:19:21 +0000 (23:19 +0000)
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

src/common/tortls.c

index 738556d24704223cee9ff5f53e9fcc9ff20bab52..e46b1a9097eed78c6d790c754efb69201029e80b 100644 (file)
@@ -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. */