Added ; check in cleaning function to help prevent injection attacks
This commit is contained in:
parent
3b487967dc
commit
f121eff48b
@ -35,9 +35,9 @@ sub soft_die {
|
||||
sub clean_input {
|
||||
my $input = shift;
|
||||
unless ($input) { return ""; }
|
||||
if ($input =~ m!%2F!) { print "Location: /hax\r\n\r\n"; exit; }
|
||||
$input =~ s!%(..)!chr hex $1!ge;
|
||||
$input =~ s!\+! !g;
|
||||
$input =~ s!;!\;!g; #antivaxx
|
||||
return $input;
|
||||
}
|
||||
|
||||
@ -55,9 +55,9 @@ if ( "rand" eq $directive ) {
|
||||
$sth = $db->prepare('SELECT * FROM posts ORDER BY DATE DESC LIMIT 1');
|
||||
} elsif ( "range" eq $directive ) {
|
||||
# select range starting with lastest as 1
|
||||
my $low = $get_params[0];
|
||||
my $high = $get_params[1];
|
||||
$sth = $db->prepare('SELECT * FROM posts ORDER BY DATE DESC LIMIT '.$low.', '.$high);
|
||||
my $start = $get_params[0];
|
||||
my $count = $get_params[1];
|
||||
$sth = $db->prepare('SELECT * FROM posts ORDER BY DATE DESC LIMIT '.$start.', '.$count);
|
||||
} else {
|
||||
# select the last 10 posts
|
||||
$sth = $db->prepare('SELECT * FROM posts ORDER BY DATE DESC LIMIT 10');
|
||||
|
Loading…
x
Reference in New Issue
Block a user