3
0
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:
Pragmatic Software 2020-06-12 12:05:25 -07:00
parent 9b0696b898
commit eb9b18cf37

View File

@ -665,12 +665,12 @@ sub expand_factoid_selectors {
my %default_opts = (
nested => 0,
recurse => 0,
recursions => 0,
);
%opts = (%default_opts, %opts);
return '!recursion limit!' if ++$opts{recurse} > 100;
return '!recursion limit!' if ++$opts{recursions} > 100;
my $result = '';
@ -713,10 +713,13 @@ sub expand_factoid_vars {
my %default_opts = (
nested => 0,
recursions => 0,
);
%opts = (%default_opts, %opts);
return '!recursion limit reached!' if ++$opts{recursions} > 100;
my $from = length $context->{ref_from} ? $context->{ref_from} : $context->{from};
my $nick = $context->{nick};
my $root_keyword = $context->{keyword_override} ? $context->{keyword_override} : $context->{root_keyword};