1
0
Fork 0

Fix #8851: don't allow infinite "exec" depth in script, but limit to 10 deep

This means if you execute a script from a script from a script, ..
for more than 10 times, it bails out now. This should be sufficient
for even the most complex scripts.
pull/8858/head
Patric Stout 2021-03-12 09:26:03 +01:00 committed by Patric Stout
parent 8230cd009d
commit 5056e963ba
1 changed files with 5 additions and 0 deletions

View File

@ -960,6 +960,11 @@ DEF_CONSOLE_CMD(ConExec)
return true;
}
if (_script_current_depth == 11) {
IConsoleError("Maximum 'exec' depth reached; script A is calling script B is calling script C ... more than 10 times.");
return true;
}
_script_current_depth++;
uint script_depth = _script_current_depth;