]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 567981 - Restore ability for page.cgi pages to contain . characters, but don...
authorReed Loden <reed@reedloden.com>
Thu, 8 Jul 2010 21:53:50 +0000 (14:53 -0700)
committerReed Loden <reed@reedloden.com>
Thu, 8 Jul 2010 21:53:50 +0000 (14:53 -0700)
[r=mkanat a=mkanat]

page.cgi

index 9326229a5d074fa70d25d777e04c5d4fb3fa55b0..33feae91972b765e4f84f6d382bde1ee51eba82d 100755 (executable)
--- a/page.cgi
+++ b/page.cgi
@@ -66,9 +66,13 @@ my $template = Bugzilla->template;
 
 my $id = $cgi->param('id');
 if ($id) {
-    # Split into name and ctype, but be careful not to allow directory
-    # traversal.
-    $id =~ /^([\w\-\/]+)\.(\w+)$/;
+    # Be careful not to allow directory traversal.
+    if ($id =~ /\.\./) {
+        # two dots in a row is bad
+        ThrowCodeError("bad_page_cgi_id", { "page_id" => $id });
+    }
+    # Split into name and ctype.
+    $id =~ /^([\w\-\/\.]+)\.(\w+)$/;
     if (!$2) {
         # if this regexp fails to match completely, something bad came in
         ThrowCodeError("bad_page_cgi_id", { "page_id" => $id });