Skip to content
Browse files

be_openssl: clear all pending errors before SSL_*() calls

Refs: #350
Reported-by: @CapSel
  • Loading branch information...
1 parent ce38993 commit 38e0f4a5d6a0a4716c875ad84e499538596e4aa9 @azat azat committed May 2, 2016
Showing with 3 additions and 0 deletions.
  1. +3 −0 bufferevent_openssl.c
View
3 bufferevent_openssl.c
@@ -593,6 +593,7 @@ do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) {
for (i=0; i<n; ++i) {
if (bev_ssl->bev.read_suspended)
break;
+ ERR_clear_error();
r = SSL_read(bev_ssl->ssl, space[i].iov_base, space[i].iov_len);
if (r>0) {
result |= OP_MADE_PROGRESS;
@@ -669,6 +670,7 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
if (space[i].iov_len == 0)
continue;
+ ERR_clear_error();
r = SSL_write(bev_ssl->ssl, space[i].iov_base,
space[i].iov_len);
if (r > 0) {
@@ -1021,6 +1023,7 @@ do_handshake(struct bufferevent_openssl *bev_ssl)
return -1;
case BUFFEREVENT_SSL_CONNECTING:
case BUFFEREVENT_SSL_ACCEPTING:
+ ERR_clear_error();
r = SSL_do_handshake(bev_ssl->ssl);
break;
}

0 comments on commit 38e0f4a

Please sign in to comment.
Something went wrong with that request. Please try again.