3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 03:33:06 +01:00

Add registry entry to control max recursion depth for interpreter

This commit is contained in:
Pragmatic Software 2014-05-31 01:05:47 +00:00
parent 7b2fb432c0
commit 60d8235999
3 changed files with 4 additions and 3 deletions

View File

@ -287,7 +287,7 @@ sub interpreter {
my ($result, $channel);
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;

View File

@ -37,6 +37,7 @@ sub initialize {
$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_ignore_channels', $conf{compile_blocks_ignore_channels} // 'none');
$self->{pbot}->{registry}->add_default('text', 'interpreter', 'max_recursion', 10);
}
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");
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 ||
not defined $command) {

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 604,
BUILD_REVISION => 605,
BUILD_DATE => "2014-05-30",
};