From a08c40df06acd30f99c797307f2d4cf2253da30c Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Wed, 25 Jun 2025 10:57:05 +0200 Subject: [PATCH] remove the asserts, let SOCKS filter create fail without hostname --- lib/connect.c | 4 ---- lib/socks.c | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index f41403c316..07e334ff2a 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -1297,8 +1297,6 @@ connect_sub_chain: if(ctx->state < CF_SETUP_CNNCT_SOCKS && cf->conn->bits.socksproxy) { /* Where do we need the SOCKS to connect to? */ if(cf->conn->bits.httpproxy) { - DEBUGASSERT(cf->conn->http_proxy.host.name); - DEBUGASSERT(cf->conn->http_proxy.port > 0); result = Curl_cf_socks_proxy_insert_after( cf, data, cf->conn->socks_proxy.proxytype, "HTTP proxy", cf->conn->http_proxy.host.name, (int)cf->conn->http_proxy.port, @@ -1315,8 +1313,6 @@ connect_sub_chain: cf->conn->bits.conn_to_port ? cf->conn->conn_to_port : cf->conn->remote_port; - DEBUGASSERT(sx_hostname); - DEBUGASSERT(sx_remote_port > 0); result = Curl_cf_socks_proxy_insert_after( cf, data, cf->conn->socks_proxy.proxytype, NULL, sx_hostname, sx_remote_port, diff --git a/lib/socks.c b/lib/socks.c index 092f9341bf..c1e1f8380f 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -1216,6 +1216,9 @@ CURLcode Curl_cf_socks_proxy_insert_after(struct Curl_cfilter *cf_at, struct socks_state *sx; CURLcode result; + if(!remote_host) + return CURLE_BAD_FUNCTION_ARGUMENT; + (void)data; sx = calloc(1, sizeof(*sx)); if(!sx) @@ -1228,8 +1231,6 @@ CURLcode Curl_cf_socks_proxy_insert_after(struct Curl_cfilter *cf_at, sx->remote_type = remote_type; sx->hostname = remote_host; sx->remote_port = remote_port; - DEBUGASSERT(sx->hostname); - DEBUGASSERT(sx->remote_port > 0); sx->proxy_user = proxy_user; sx->proxy_password = proxy_password; sx = NULL;