mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
Limit maximum number of factoid variable expansions
This commit is contained in:
parent
9acb38d790
commit
69c081fd9a
@ -403,11 +403,12 @@ sub expand_factoid_vars {
|
||||
|
||||
my $depth = 0;
|
||||
while (1) {
|
||||
last if ++$depth >= 10;
|
||||
last if ++$depth >= 20;
|
||||
my $matches = 0;
|
||||
$action =~ s/\$0/$root_keyword/g;
|
||||
my $const_action = $action;
|
||||
while ($const_action =~ /(\ba\s*|\ban\s*)?(?<!\\)\$([a-zA-Z0-9_:\-#\[\]]+)/gi) {
|
||||
last if ++$depth >= 20;
|
||||
my ($a, $v) = ($1, $2);
|
||||
$v =~ s/(.):$/$1/;
|
||||
next if $v =~ m/^_/; # underscore-prefixed vars reserved for code-factoids
|
||||
@ -520,10 +521,13 @@ sub expand_action_arguments {
|
||||
|
||||
$action =~ s/\$arglen\b/scalar @args/eg;
|
||||
|
||||
my $depth = 0;
|
||||
my $const_action = $action;
|
||||
while ($const_action =~ m/\$arg\[([^]]+)]/g) {
|
||||
my $arg = $1;
|
||||
|
||||
last if ++$depth >= 20;
|
||||
|
||||
if ($arg eq '*') {
|
||||
if (not defined $input or $input eq '') {
|
||||
$action =~ s/\$arg\[\*\]/$nick/;
|
||||
|
Loading…
Reference in New Issue
Block a user