]> granicus.if.org Git - libevent/commit
Fixed potential double-readcb execution with openssl bufferevents.
authorMark Ellzey <socket@gmail.com>
Fri, 30 Mar 2012 19:08:40 +0000 (15:08 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 1 May 2012 01:02:01 +0000 (21:02 -0400)
commit4e62cd167b66f33e20344bff776253f19e2bc3e6
tree7f2da8cf7768c18034cb8fddacbfccb4d633c392
parent30b6f889f7d8a6dc3174a35641772d3c9294eaec
Fixed potential double-readcb execution with openssl bufferevents.

the function do_read() will call SSL_read(), and if successful, will
call _bufferevent_run_readcb() before returning to consider_reading().

consider_reading() will then check SSL_pending() to make sure all
pending data has also been read. If it does not, do_read() is called
again.

The issue with this is the possibility that the function that is
executed by _bufferevent_run_readcb() called
bufferevent_disable(ssl_bev, EV_READ) before the second do_read(); In
this case, the users read callback is executed a second time. This is
potentially bad for applications that expect the bufferevent to stay
disabled until further notice. (this is why running openssl bufferevents
without DEFER_CALLBACKS has always been troublesome).
bufferevent_openssl.c