Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Add call ERR_clear_error() before SSL_* calls #100

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stud.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ static void client_handshake(struct ev_loop *loop, ev_io *w, int revents) {
int t;
proxystate *ps = (proxystate *)w->data;

ERR_clear_error();
t = SSL_do_handshake(ps->ssl);
if (t == 1) {
end_handshake(ps);
Expand Down Expand Up @@ -1046,6 +1047,7 @@ static void ssl_read(struct ev_loop *loop, ev_io *w, int revents) {
return;
}
char * buf = ringbuffer_write_ptr(&ps->ring_ssl2clear);
ERR_clear_error();
t = SSL_read(ps->ssl, buf, RING_DATA_LEN);

/* Fix CVE-2009-3555. Disable reneg if started by client. */
Expand Down Expand Up @@ -1081,6 +1083,7 @@ static void ssl_write(struct ev_loop *loop, ev_io *w, int revents) {
proxystate *ps = (proxystate *)w->data;
assert(!ringbuffer_is_empty(&ps->ring_clear2ssl));
char * next = ringbuffer_read_next(&ps->ring_clear2ssl, &sz);
ERR_clear_error();
t = SSL_write(ps->ssl, next, sz);
if (t > 0) {
if (t == sz) {
Expand Down