mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 04:11:18 +00:00
Detect infinite alias self-recursion mixed with other commands, such as in the case of alias a "echo test; a"; a
.
(Unfortunately, this does not work if "wait" is used instead of "echo", but oh well)
This commit is contained in:
parent
6d95f3ceb2
commit
797ca99f42
1 changed files with 5 additions and 8 deletions
|
@ -514,7 +514,6 @@ static void COM_ExecuteString(char *ptext)
|
||||||
{
|
{
|
||||||
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||||
{
|
{
|
||||||
recursion = 0;
|
|
||||||
cmd->function();
|
cmd->function();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -526,19 +525,17 @@ static void COM_ExecuteString(char *ptext)
|
||||||
if (!stricmp(com_argv[0], a->name))
|
if (!stricmp(com_argv[0], a->name))
|
||||||
{
|
{
|
||||||
if (recursion > MAX_ALIAS_RECURSION)
|
if (recursion > MAX_ALIAS_RECURSION)
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
||||||
recursion = 0;
|
else
|
||||||
return;
|
{ // Monster Iestyn: keep track of how many levels of recursion we're in
|
||||||
|
recursion++;
|
||||||
|
COM_BufInsertText(a->value);
|
||||||
|
recursion--;
|
||||||
}
|
}
|
||||||
recursion++;
|
|
||||||
COM_BufInsertText(a->value);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recursion = 0;
|
|
||||||
|
|
||||||
// check cvars
|
// check cvars
|
||||||
// Hurdler: added at Ebola's request ;)
|
// Hurdler: added at Ebola's request ;)
|
||||||
// (don't flood the console in software mode with bad gr_xxx command)
|
// (don't flood the console in software mode with bad gr_xxx command)
|
||||||
|
|
Loading…
Reference in a new issue