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.
This commit is contained in:
Patric Stout
2021-03-12 09:26:03 +01:00
committed by Patric Stout
parent 8230cd009d
commit 5056e963ba

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;