From: Matthias Lederhofer <matled@gmx.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb fix validating pg (page) parameter
Date: Sun, 17 Sep 2006 23:38:38 +0200 [thread overview]
Message-ID: <20060917213838.GA12782@moooo.ath.cx> (raw)
In-Reply-To: <7vlkoi2nqr.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Matthias Lederhofer <matled@gmx.net> 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(...);
> }
The first page seems to have number 0. After removing the 1 <= $page
this code should do the same as my patch, apply whatever you think is
easier to read (I prefer if over unless most of the time).
next prev parent reply other threads:[~2006-09-17 21:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-17 11:52 [PATCH] gitweb fix validating pg (page) parameter Matthias Lederhofer
2006-09-17 21:21 ` Junio C Hamano
2006-09-17 21:38 ` Matthias Lederhofer [this message]
2006-09-17 21:45 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060917213838.GA12782@moooo.ath.cx \
--to=matled@gmx.net \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).