Skip to content

Commit f25797d

Browse files
jhawthornptitSeb
authored andcommitted
OpenSSL: clear error queue after SSL_shutdown
We've seen errors left in the OpenSSL error queue (specifically, "shutdown while in init") by adding some logging it revealed that the source was this file. Since we call SSL_read and SSL_shutdown here, but don't check the return code for an error, we should clear the OpenSSL error queue in case one was raised. This didn't affect curl because we call ERR_clear_error before every write operation (a0dd9df), but when libcurl is used in a process with other OpenSSL users, they may detect an OpenSSL error pushed by libcurl's SSL_shutdown as if it was their own. Co-authored-by: Satana de Sant'Ana <[email protected]> Closes curl#11736
1 parent 7353125 commit f25797d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/vtls/openssl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,9 @@ static void ossl_close(struct Curl_cfilter *cf, struct Curl_easy *data)
18841884
(void)SSL_read(backend->handle, buf, (int)sizeof(buf));
18851885

18861886
(void)SSL_shutdown(backend->handle);
1887+
1888+
ERR_clear_error();
1889+
18871890
SSL_set_connect_state(backend->handle);
18881891
}
18891892

0 commit comments

Comments
 (0)