@matheusbsbs / matheus-bagliano / commits / dbd954a896
Fork 0

gitweb: Don't undefine query parameter related variables before die_error

Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Aug 5, 2006 at 12:58 UTC dbd954a8969a31741a676e9e7cc2dfd00f8f4e93
1 file changed +5 -16
gitweb/gitweb.perl
+5 -16
@@ -76,7 +76,6 @@ if (! -d $git_temp) {
76 our $action = $cgi->param('a');
77 if (defined $action) {
78 if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
79 - undef $action;
79 die_error(undef, "Invalid action parameter.");
80 }
81 # action which does not check rest of parameters
@@ -89,16 +88,13 @@ if (defined $action) {
88 our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
89 if (defined $project) {
90 $project =~ s|^/||; $project =~ s|/$||;
92 - $project = validate_input($project);
93 - if (!defined($project)) {
91 + if (!validate_input($project)) {
92 die_error(undef, "Invalid project parameter.");
93 }
94 if (!(-d "$projectroot/$project")) {
97 - undef $project;
95 die_error(undef, "No such directory.");
96 }
97 if (!(-e "$projectroot/$project/HEAD")) {
101 - undef $project;
98 die_error(undef, "No such project.");
99 }
100 $rss_link = "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" .
@@ -111,32 +107,28 @@ if (defined $project) {
107
108 our $file_name = $cgi->param('f');
109 if (defined $file_name) {
114 - $file_name = validate_input($file_name);
115 - if (!defined($file_name)) {
110 + if (!validate_input($file_name)) {
111 die_error(undef, "Invalid file parameter.");
112 }
113 }
114
115 our $hash = $cgi->param('h');
116 if (defined $hash) {
122 - $hash = validate_input($hash);
123 - if (!defined($hash)) {
117 + if (!validate_input($hash)) {
118 die_error(undef, "Invalid hash parameter.");
119 }
120 }
121
122 our $hash_parent = $cgi->param('hp');
123 if (defined $hash_parent) {
130 - $hash_parent = validate_input($hash_parent);
131 - if (!defined($hash_parent)) {
124 + if (!validate_input($hash_parent)) {
125 die_error(undef, "Invalid hash parent parameter.");
126 }
127 }
128
129 our $hash_base = $cgi->param('hb');
130 if (defined $hash_base) {
138 - $hash_base = validate_input($hash_base);
139 - if (!defined($hash_base)) {
131 + if (!validate_input($hash_base)) {
132 die_error(undef, "Invalid hash base parameter.");
133 }
134 }
@@ -144,7 +136,6 @@ if (defined $hash_base) {
136 our $page = $cgi->param('pg');
137 if (defined $page) {
138 if ($page =~ m/[^0-9]$/) {
147 - undef $page;
139 die_error(undef, "Invalid page parameter.");
140 }
141 }
@@ -152,7 +143,6 @@ if (defined $page) {
143 our $searchtext = $cgi->param('s');
144 if (defined $searchtext) {
145 if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
155 - undef $searchtext;
146 die_error(undef, "Invalid search parameter.");
147 }
148 $searchtext = quotemeta $searchtext;
@@ -182,7 +172,6 @@ my %actions = (
172
173 $action = 'summary' if (!defined($action));
174 if (!defined($actions{$action})) {
185 - undef $action;
175 die_error(undef, "Unknown action.");
176 }
177 $actions{$action}->();