aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'page.cgi')
-rwxr-xr-xpage.cgi6
1 files changed, 3 insertions, 3 deletions
diff --git a/page.cgi b/page.cgi
index cd6cb611e..9326229a5 100755
--- a/page.cgi
+++ b/page.cgi
@@ -66,9 +66,9 @@ my $template = Bugzilla->template;
my $id = $cgi->param('id');
if ($id) {
- # Remove all dodgy chars, and split into name and ctype.
- $id =~ s/[^\w\-\.]//g;
- $id =~ /(.*)\.(.*)/;
+ # Split into name and ctype, but be careful not to allow directory
+ # traversal.
+ $id =~ /^([\w\-\/]+)\.(\w+)$/;
if (!$2) {
# if this regexp fails to match completely, something bad came in
ThrowCodeError("bad_page_cgi_id", { "page_id" => $id });