]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix segmentation fault in ACLUrlPathStrategy::match
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 11 Nov 2014 04:55:56 +0000 (20:55 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 11 Nov 2014 04:55:56 +0000 (20:55 -0800)
CONNECT requests do not contain a path segment. If tested with a
urlpath_regex ACL will crash Squid via xstrdup() NULL protection.

src/acl/UrlPath.cc

index e9cdec1c69846a049c3bf90478270dfba4a1d89e..8a863516d91d975ac4ae0da86daec31c80744128 100644 (file)
@@ -18,6 +18,9 @@
 int
 ACLUrlPathStrategy::match (ACLData<char const *> * &data, ACLFilledChecklist *checklist, ACLFlags &)
 {
+    if (!checklist->request->urlpath.size())
+        return -1;
+
     char *esc_buf = xstrdup(checklist->request->urlpath.termedBuf());
     rfc1738_unescape(esc_buf);
     int result = data->match(esc_buf);