]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchview: do not allow non-ASCII offsets and limits
authorEric Wong <e@80x24.org>
Tue, 4 Jun 2019 02:04:33 +0000 (02:04 +0000)
committerEric Wong <e@80x24.org>
Tue, 4 Jun 2019 10:06:18 +0000 (10:06 +0000)
Non-ASCII digits would be interpreted as zero when used as integers.

lib/PublicInbox/SearchView.pm

index 6592b3b28e27363c769c381d510d3e318535ce90..b089de9c91412cb1e4e42a431256b97c8ebafa63 100644 (file)
@@ -308,12 +308,12 @@ sub new {
        my ($class, $qp) = @_;
 
        my $r = $qp->{r};
-       my ($l) = (($qp->{l} || '') =~ /(\d+)/);
+       my ($l) = (($qp->{l} || '') =~ /([0-9]+)/);
        $l = $LIM if !$l || $l > $LIM;
        bless {
                q => $qp->{'q'},
                x => $qp->{x} || '',
-               o => (($qp->{o} || '0') =~ /(\d+)/),
+               o => (($qp->{o} || '0') =~ /([0-9]+)/),
                l => $l,
                r => (defined $r && $r ne '0'),
        }, $class;