]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix segmentation fault in ACLUrlPathStrategy::match
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 13 Nov 2014 08:19:06 +0000 (00:19 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 13 Nov 2014 08:19:06 +0000 (00:19 -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 018e20bbc5a6eeef1430f68c1702c568fb26af7b..8d17ae84bacc435b96c88bb1b4433e28833877b9 100644 (file)
@@ -42,6 +42,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);