From: Daniel Stenberg Date: Tue, 11 Apr 2023 12:40:46 +0000 (+0200) Subject: schannel: add clarifying comment X-Git-Tag: curl-8_1_0~185 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=90aea8e2a907fd71d188f9487adbe12ef51a007a;p=thirdparty%2Fcurl.git schannel: add clarifying comment Explaining how the PVS warning in #10929 is wrong: Dereferencing of the null pointer 'backend->cred' might take place. Closes #10931 --- diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 6f94c7e349..430a41c13d 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1171,9 +1171,11 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) if(!backend->cred) { char *snihost; result = schannel_acquire_credential_handle(cf, data); - if(result != CURLE_OK) { + if(result) return result; - } + /* schannel_acquire_credential_handle() sets backend->cred accordingly or + it returns error otherwise. */ + /* A hostname associated with the credential is needed by InitializeSecurityContext for SNI and other reasons. */ snihost = Curl_ssl_snihost(data, hostname, NULL);