]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
schannel: replace a run-time condition with an assert
authorDaniel Stenberg <daniel@haxx.se>
Thu, 23 Oct 2025 14:00:46 +0000 (16:00 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 23 Oct 2025 20:52:02 +0000 (22:52 +0200)
For detecting a bad function argument that probably also would cause a
compiler warning.

Closes #19203

lib/vtls/schannel.c

index 9b2b1e702e81ffba2d7d21396ad4ed613f7d3425..2e29ea2f185e215579dea8e9d12c23820cd6755a 100644 (file)
@@ -1711,15 +1711,11 @@ schannel_recv_renegotiate(struct Curl_cfilter *cf, struct Curl_easy *data,
     failf(data, "schannel: unexpected call to schannel_recv_renegotiate");
     return CURLE_SSL_CONNECT_ERROR;
   }
-
+  DEBUGASSERT(caller <= SCH_RENEG_CALLER_IS_SEND);
   if(caller == SCH_RENEG_CALLER_IS_RECV)
     SCH_DEV(infof(data, "schannel: renegotiation caller is schannel_recv"));
-  else if(caller == SCH_RENEG_CALLER_IS_SEND)
+  else
     SCH_DEV(infof(data, "schannel: renegotiation caller is schannel_send"));
-  else {
-    failf(data, "schannel: unknown caller for schannel_recv_renegotiate");
-    return CURLE_SSL_CONNECT_ERROR;
-  }
 
   sockfd = Curl_conn_cf_get_socket(cf, data);