From: Daniel Stenberg Date: Sat, 20 Sep 2025 15:14:10 +0000 (+0200) Subject: schannel: assign result before using it X-Git-Tag: rc-8_17_0-1~315 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=94eec0a788dbc80e87d7168be1bfb10d734d0ab3;p=thirdparty%2Fcurl.git schannel: assign result before using it curl_easy_strerror(result) was called *before* result was assigned. Reported in Joshua's sarif data Closes #18642 --- diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index b511c43277..8b7f1d9306 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -2451,9 +2451,9 @@ static CURLcode schannel_shutdown(struct Curl_cfilter *cf, Curl_pSecFn->FreeContextBuffer(outbuf.pvBuffer); if(!result) { if(written < outbuf.cbBuffer) { + result = CURLE_SEND_ERROR; failf(data, "schannel: failed to send close msg: %s" " (bytes written: %zu)", curl_easy_strerror(result), written); - result = CURLE_SEND_ERROR; goto out; } backend->sent_shutdown = TRUE; @@ -2466,8 +2466,8 @@ static CURLcode schannel_shutdown(struct Curl_cfilter *cf, } else { if(!backend->recv_connection_closed) { - failf(data, "schannel: error sending close msg: %d", result); result = CURLE_SEND_ERROR; + failf(data, "schannel: error sending close msg: %d", result); goto out; } /* Looks like server already closed the connection.