mirror of
https://github.com/pragma-/pbot.git
synced 2024-10-05 10:58:44 +02:00
Add registry entry to control max recursion depth for interpreter
This commit is contained in:
parent
7b2fb432c0
commit
60d8235999
@ -287,7 +287,7 @@ sub interpreter {
|
|||||||
my ($result, $channel);
|
my ($result, $channel);
|
||||||
my $pbot = $self->{pbot};
|
my $pbot = $self->{pbot};
|
||||||
|
|
||||||
return undef if not length $keyword or $count > 5;
|
return undef if not length $keyword or $count > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion');
|
||||||
|
|
||||||
$from = lc $from;
|
$from = lc $from;
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ sub initialize {
|
|||||||
$self->{pbot}->{registry}->add_default('text', 'general', 'compile_blocks', $conf{compile_blocks} // 1);
|
$self->{pbot}->{registry}->add_default('text', 'general', 'compile_blocks', $conf{compile_blocks} // 1);
|
||||||
$self->{pbot}->{registry}->add_default('array', 'general', 'compile_blocks_channels', $conf{compile_blocks_channels} // '.*');
|
$self->{pbot}->{registry}->add_default('array', 'general', 'compile_blocks_channels', $conf{compile_blocks_channels} // '.*');
|
||||||
$self->{pbot}->{registry}->add_default('array', 'general', 'compile_blocks_ignore_channels', $conf{compile_blocks_ignore_channels} // 'none');
|
$self->{pbot}->{registry}->add_default('array', 'general', 'compile_blocks_ignore_channels', $conf{compile_blocks_ignore_channels} // 'none');
|
||||||
|
$self->{pbot}->{registry}->add_default('text', 'interpreter', 'max_recursion', 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub process_line {
|
sub process_line {
|
||||||
@ -200,7 +201,7 @@ sub interpret {
|
|||||||
|
|
||||||
$pbot->{logger}->log("=== Enter interpret_command: [" . (defined $from ? $from : "(undef)") . "][$nick!$user\@$host][$count][$command]\n");
|
$pbot->{logger}->log("=== Enter interpret_command: [" . (defined $from ? $from : "(undef)") . "][$nick!$user\@$host][$count][$command]\n");
|
||||||
|
|
||||||
return "Too many levels of recursion, aborted." if(++$count > 5);
|
return "Too many levels of recursion, aborted." if(++$count > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion'));
|
||||||
|
|
||||||
if(not defined $nick || not defined $user || not defined $host ||
|
if(not defined $nick || not defined $user || not defined $host ||
|
||||||
not defined $command) {
|
not defined $command) {
|
||||||
|
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 604,
|
BUILD_REVISION => 605,
|
||||||
BUILD_DATE => "2014-05-30",
|
BUILD_DATE => "2014-05-30",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user