From 1386135d1c65a3d32c2887a60e66b41afef341ec Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 15 Jul 2026 18:04:59 +0200 Subject: [PATCH] schannel: fix error check logic in `get_client_cert()` file reader Reported by GitHub Code Quality Follow-up to 0fdf96512613574591f501d63fe49495ba40e1d5 #5193 Closes #22415 --- lib/vtls/schannel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index f55784c624..583c87222d 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -441,12 +441,13 @@ static CURLcode get_client_cert(struct Curl_cfilter *cf, if(fInCert) { long cert_tell = 0; bool continue_reading = fseek(fInCert, 0, SEEK_END) == 0; - if(continue_reading) + if(continue_reading) { cert_tell = ftell(fInCert); - if(cert_tell < 0) - continue_reading = FALSE; - else - certsize = (size_t)cert_tell; + if(cert_tell < 0) + continue_reading = FALSE; + else + certsize = (size_t)cert_tell; + } if(continue_reading) continue_reading = fseek(fInCert, 0, SEEK_SET) == 0; if(continue_reading && (certsize < CURL_MAX_INPUT_LENGTH))