]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
noproxy: guard against empty hostnames in noproxy check
authorDaniel Gustafsson <daniel@yesql.se>
Thu, 8 Dec 2022 22:37:32 +0000 (23:37 +0100)
committerDaniel Gustafsson <daniel@yesql.se>
Thu, 8 Dec 2022 22:37:32 +0000 (23:37 +0100)
When checking for a noproxy setting we need to ensure that we get
a hostname passed in. If there is no hostname then there cannot be
a matching noproxy rule for it by definition.

Closes: #10057
Reported-by: Geeknik Labs
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
lib/noproxy.c

index fb856e4faa725b2675d768669dbefbb07e52610f..9b13fe8956edc303baa174266bef0d2eff63ee6a 100644 (file)
@@ -121,6 +121,13 @@ enum nametype {
 ****************************************************************/
 bool Curl_check_noproxy(const char *name, const char *no_proxy)
 {
+  /*
+   * If we don't have a hostname at all, like for example with a FILE
+   * transfer, we have nothing to interrogate the noproxy list with.
+   */
+  if(!name || name[0] == '\0')
+    return FALSE;
+
   /* no_proxy=domain1.dom,host.domain2.dom
    *   (a comma-separated list of hosts which should
    *   not be proxied, or an asterisk to override