Fix /eval recursion crashing (debian/patches/04eval_recurse.dpatch by David Pashley)

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3865 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Wouter Coekaerts 2005-07-17 16:43:18 +00:00 committed by coekie
commit 547065cb42
5 changed files with 12 additions and 2 deletions

View file

@ -945,12 +945,18 @@ static void event_command(const char *line, SERVER_REC *server, void *item)
parse_command(line, expand_aliases, server, item);
}
static int eval_recursion_depth=0;
/* SYNTAX: EVAL <command(s)> */
static void cmd_eval(const char *data, SERVER_REC *server, void *item)
{
g_return_if_fail(data != NULL);
if (eval_recursion_depth > 100)
cmd_return_error(CMDERR_EVAL_MAX_RECURSE);
eval_recursion_depth++;
eval_special_string(data, "", server, item);
eval_recursion_depth--;
}
/* SYNTAX: CD <directory> */

View file

@ -39,7 +39,8 @@ enum {
CMDERR_ILLEGAL_PROTO, /* requires different chat protocol than the active server */
CMDERR_NOT_GOOD_IDEA, /* not good idea to do, -yes overrides this */
CMDERR_INVALID_TIME, /* invalid time specification */
CMDERR_INVALID_CHARSET /* invalid charset specification */
CMDERR_INVALID_CHARSET, /* invalid charset specification */
CMDERR_EVAL_MAX_RECURSE /* eval hit recursion limit */
};
/* Return the full command for `alias' */