diff --git a/gitweb.cgi b/gitweb.cgi
index 15bb123b21..4ad3ce4dcb 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -14,7 +14,7 @@ use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
-my $version = "082";
+my $version = "085";
my $projectroot = "/pub/scm";
my $home_link = "/git";
my $gitbin = "/usr/bin";
@@ -22,107 +22,116 @@ my $gittmp = "/tmp/gitweb";
my $logo_link = "/pub/software/scm/cogito";
my $my_url = $cgi->url();
my $my_uri = $cgi->url(-absolute => 1);
+my $rss_link = "";
-mkdir($gittmp, 0700);
my $project = $cgi->param('p');
-my $action = $cgi->param('a');
-my $hash = $cgi->param('h');
-my $hash_parent = $cgi->param('hp');
-my $file_name = $cgi->param('f');
-my $time_back = $cgi->param('t');
-$ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
-
-# validate input
if (defined($project)) {
if ($project =~ /(^|\/)(|\.|\.\.)($|\/)/) {
+ $project = "";
die_error("", "Invalid project parameter.");
}
if (!(-d "$projectroot/$project")) {
+ $project = "";
die_error("", "No such project.");
}
+ $rss_link = "";
}
+
+my $file_name = $cgi->param('f');
if (defined($file_name) && $file_name =~ /(^|\/)(|\.|\.\.)($|\/)/) {
+ $file_name = "";
die_error("", "Invalid file parameter.");
}
-if (defined($action) && !$action =~ m/^[0-9a-zA-Z\.\-]+$/) {
+
+my $action = $cgi->param('a');
+if (defined($action) && $action =~ m/[^0-9a-zA-Z\.\-]+$/) {
+ $action = "";
die_error("", "Invalid action parameter.");
}
+
+my $hash = $cgi->param('h');
if (defined($hash) && !($hash =~ m/^[0-9a-fA-F]{40}$/)) {
+ $hash = "";
die_error("", "Invalid hash parameter.");
}
+
+my $hash_parent = $cgi->param('hp');
if (defined($hash_parent) && !($hash_parent =~ m/^[0-9a-fA-F]{40}$/)) {
+ $hash_parent = "";
die_error("", "Invalid parent hash parameter.");
}
+
+my $time_back = $cgi->param('t');
if (defined($time_back) && !($time_back =~ m/^[0-9]+$/)) {
+ $time_back = "";
die_error("", "Invalid time parameter.");
}
+$ENV{'SHA1_FILE_DIRECTORY'} = "$projectroot/$project/objects";
+mkdir($gittmp, 0700);
+
sub git_header_html {
my $status = shift || "200 OK";
print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status);
print <
+
- git - $project $action
-
-
+git - $project
+$rss_link
+
EOF
@@ -140,13 +149,18 @@ EOF
}
sub git_footer_html {
- print "\n" .
+ "\n" .
"