Fix NULL pointer dereference in bev write handler

Only manipulate other->bev if it is not NULL to avoid a NULL pointer
dereference in the proxy bufferevent write handler when only one
direction is fully established, for example during connection shutdown.

Reported by:	@david-holonet
Introduced in:	2bcfaf4
Issue:		#109
This commit is contained in:
Daniel Roethlisberger 2015-11-01 17:49:31 +01:00
parent 2bcfaf4b44
commit 17d753fc2d

View File

@ -1664,7 +1664,7 @@ pxy_bev_writecb(struct bufferevent *bev, void *arg)
}
#endif /* DEBUG_PROXY */
if (!(bufferevent_get_enabled(other->bev) & EV_READ)) {
if (other->bev && !(bufferevent_get_enabled(other->bev) & EV_READ)) {
/* data source temporarily disabled;
* re-enable and reset watermark to 0. */
bufferevent_setwatermark(bev, EV_WRITE, 0, 0);