mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 22:09:26 +01:00
Factoids: fix potential infinite recursion in $var expansion
This commit is contained in:
parent
9b0696b898
commit
eb9b18cf37
@ -665,12 +665,12 @@ sub expand_factoid_selectors {
|
|||||||
|
|
||||||
my %default_opts = (
|
my %default_opts = (
|
||||||
nested => 0,
|
nested => 0,
|
||||||
recurse => 0,
|
recursions => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
%opts = (%default_opts, %opts);
|
%opts = (%default_opts, %opts);
|
||||||
|
|
||||||
return '!recursion limit!' if ++$opts{recurse} > 100;
|
return '!recursion limit!' if ++$opts{recursions} > 100;
|
||||||
|
|
||||||
my $result = '';
|
my $result = '';
|
||||||
|
|
||||||
@ -713,10 +713,13 @@ sub expand_factoid_vars {
|
|||||||
|
|
||||||
my %default_opts = (
|
my %default_opts = (
|
||||||
nested => 0,
|
nested => 0,
|
||||||
|
recursions => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
%opts = (%default_opts, %opts);
|
%opts = (%default_opts, %opts);
|
||||||
|
|
||||||
|
return '!recursion limit reached!' if ++$opts{recursions} > 100;
|
||||||
|
|
||||||
my $from = length $context->{ref_from} ? $context->{ref_from} : $context->{from};
|
my $from = length $context->{ref_from} ? $context->{ref_from} : $context->{from};
|
||||||
my $nick = $context->{nick};
|
my $nick = $context->{nick};
|
||||||
my $root_keyword = $context->{keyword_override} ? $context->{keyword_override} : $context->{root_keyword};
|
my $root_keyword = $context->{keyword_override} ? $context->{keyword_override} : $context->{root_keyword};
|
||||||
|
Loading…
Reference in New Issue
Block a user