]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix segmentation fault on -k parse (#218) M-staged-PR218
authorAmos Jeffries <yadij@users.noreply.github.com>
Wed, 4 Jul 2018 10:30:12 +0000 (10:30 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 4 Jul 2018 10:30:17 +0000 (10:30 +0000)
When an HTTPS or SSL-Bump port is configured without a cert=
parameter it results in a segmentation fault. Detect that
occurance and add the required FATAL error message instead for
these configurations where cert= is a parameter rather than an
option.

Our project terminology for config settings is;

 "parameter"
 -  a required setting. Print a FATAL error message if missing.

 "option"
 -  an optional setting. Ignored or default value if missing.

src/cache_cf.cc

index 3363803a3774c92f5c73544c8f1df4e5877e347b..414be89c52fda30b3b85f60e3b44bcfdbaa804e6 100644 (file)
@@ -3825,6 +3825,15 @@ parsePortCfg(AnyP::PortCfgPointer *head, const char *optionName)
         }
     }
 
+    if (s->secure.encryptTransport) {
+        if (s->secure.certs.empty()) {
+            debugs(3, DBG_CRITICAL, "FATAL: " << AnyP::UriScheme(s->transport.protocol) << "_port requires a cert= parameter");
+            self_destruct();
+            return;
+        }
+    }
+
+    // *_port line should now be fully valid so we can clone it if necessary
     if (Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK && s->s.isAnyAddr()) {
         // clone the port options from *s to *(s->next)
         s->next = s->clone();