mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
*PROPERLY* disable RUN in eval. :)
This commit is contained in:
10
src/funcs.c
10
src/funcs.c
@@ -3993,6 +3993,7 @@ FEval(func_info *info)
|
||||
{
|
||||
expr_node *n;
|
||||
int r;
|
||||
int run_was_enabled = 0;
|
||||
|
||||
ASSERT_TYPE(0, STR_TYPE);
|
||||
char const *e = ARGSTR(0);
|
||||
@@ -4004,9 +4005,14 @@ FEval(func_info *info)
|
||||
}
|
||||
|
||||
/* Disable shell() command in eval */
|
||||
RunDisabled |= RUN_IN_EVAL;
|
||||
if (! (RunDisabled & RUN_IN_EVAL)) {
|
||||
run_was_enabled = 1;
|
||||
RunDisabled |= RUN_IN_EVAL;
|
||||
}
|
||||
r = evaluate_expr_node(n, NULL, &(info->retval), &(info->nonconst));
|
||||
RunDisabled &= ~RUN_IN_EVAL;
|
||||
if (run_was_enabled) {
|
||||
RunDisabled &= ~RUN_IN_EVAL;
|
||||
}
|
||||
free_expr_tree(n);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -16542,11 +16542,18 @@ Entering UserFN i()
|
||||
shell("echo foo") => "foo"
|
||||
Leaving UserFN i() => "foo"
|
||||
FUNSET i
|
||||
set a "eval(\"1\")+ shell(\"ls\")"
|
||||
set b eval(a)
|
||||
a => "eval(\"1\")+ shell(\"ls\")"
|
||||
eval("eval(\"1\")+ shell(\"ls\")") => eval("1") => 1
|
||||
shell("ls") => RUN disabled
|
||||
../tests/test.rem(1587): shell(): RUN disabled
|
||||
RUN disabled
|
||||
|
||||
DEBUG -x
|
||||
|
||||
DEBUG -e
|
||||
../tests/test.rem(1593): eval(): Too many recursive function calls
|
||||
../tests/test.rem(1595): eval(): Too many recursive function calls
|
||||
Base: 1991-02-09
|
||||
Base: 1991-02-09
|
||||
Variable hash table statistics:
|
||||
|
||||
@@ -1583,6 +1583,8 @@ set a i()
|
||||
set a eval("i()")
|
||||
set a i()
|
||||
FUNSET i
|
||||
set a "eval(\"1\")+ shell(\"ls\")"
|
||||
set b eval(a)
|
||||
|
||||
DEBUG -x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user