From: Junio C Hamano Date: Sun, 17 Sep 2006 21:21:16 GMT Subject: Re: [PATCH] gitweb fix validating pg (page) parameter Message-ID: <7vlkoi2nqr.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20060917115245.GA15658@moooo.ath.cx> Matthias Lederhofer writes: > Currently it is possible to give any string ending with a number as > page. -1 for example is quite bad (error log shows probably 100 > warnings). > > @@ -259,7 +259,7 @@ if (defined $hash_parent_base) { > > our $page = $cgi->param('pg'); > if (defined $page) { > - if ($page =~ m/[^0-9]$/) { > + if ($page =~ m/[^0-9]/) { > die_error(undef, "Invalid page parameter"); > } > } Are we complaining if $page is not a validly formatted number here? If so why not unless ($page =~ /^\d+$/ && 1 <= $page) { barf(...); } ???