mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-17 08:17:42 -04:00
Don't call BIO_number_{read|written} on NULL BIOs.
OpenSSL doesn't document the behaviour of these functions when given a NULL BIO, and it happens to return zero at the moment. But don't depend on that. Closes: #406 (cherry-picked)
This commit is contained in:
parent
f9803a6943
commit
6702da1a8c
@ -542,10 +542,10 @@ conn_closed(struct bufferevent_openssl *bev_ssl, int when, int errcode, int ret)
|
||||
static void
|
||||
init_bio_counts(struct bufferevent_openssl *bev_ssl)
|
||||
{
|
||||
bev_ssl->counts.n_written =
|
||||
BIO_number_written(SSL_get_wbio(bev_ssl->ssl));
|
||||
bev_ssl->counts.n_read =
|
||||
BIO_number_read(SSL_get_rbio(bev_ssl->ssl));
|
||||
BIO *wbio = SSL_get_wbio(bev_ssl->ssl);
|
||||
bev_ssl->counts.n_written = wbio ? BIO_number_written(wbio) : 0;
|
||||
BIO *rbio = SSL_get_rbio(bev_ssl->ssl);
|
||||
bev_ssl->counts.n_read = rbio ? BIO_number_read(rbio) : 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
Loading…
x
Reference in New Issue
Block a user