From 2ab19b9e259dfef9eb78a8efc42ef2453126417b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 22 May 2016 20:44:34 +0000 Subject: www: avoid warnings on bad offsets for Xapian The offset argument must be an integer for Xapian, however users (or bots) type the darndest things. AFAIK this has no security implications besides triggering a warning (which could lead to out-of-space-errors) --- lib/PublicInbox/SearchView.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index c0cd1ffd..e3dc22f7 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -263,10 +263,11 @@ use PublicInbox::Hval; sub new { my ($class, $cgi) = @_; my $r = $cgi->param('r'); + my ($off) = (($cgi->param('o') || '0') =~ /(\d+)/); bless { q => $cgi->param('q'), x => $cgi->param('x') || '', - o => int($cgi->param('o') || 0) || 0, + o => $off, r => (defined $r && $r ne '0'), }, $class; } -- cgit v1.2.3-24-ge0c7