]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: call SSL_get_error() with proper error
authorDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 08:39:29 +0000 (10:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 09:31:54 +0000 (11:31 +0200)
The error function should be called with the return code from the
previous call to SSL_shutdown() as argument.

Closes #18872

lib/vtls/openssl.c

index 0714ce7c6ae0b2a9b67d6b6b43178db392ffeb53..409c9c09460c5fec8308e5eb006e61da57386408 100644 (file)
@@ -2169,14 +2169,16 @@ static CURLcode ossl_shutdown(struct Curl_cfilter *cf,
   /* SSL should now have started the shutdown from our side. Since it
    * was not complete, we are lacking the close notify from the server. */
   if(send_shutdown && !(SSL_get_shutdown(octx->ssl) & SSL_SENT_SHUTDOWN)) {
+    int rc;
     ERR_clear_error();
     CURL_TRC_CF(data, cf, "send SSL close notify");
-    if(SSL_shutdown(octx->ssl) == 1) {
+    rc = SSL_shutdown(octx->ssl);
+    if(rc == 1) {
       CURL_TRC_CF(data, cf, "SSL shutdown finished");
       *done = TRUE;
       goto out;
     }
-    if(SSL_ERROR_WANT_WRITE == SSL_get_error(octx->ssl, nread)) {
+    if(SSL_ERROR_WANT_WRITE == SSL_get_error(octx->ssl, rc)) {
       CURL_TRC_CF(data, cf, "SSL shutdown still wants to send");
       connssl->io_need = CURL_SSL_IO_NEED_SEND;
       goto out;