Skip to content

Commit 0de7eec

Browse files
committed
Fixed disclosure of local variables by eval; ref #3710
This patch fixes the latter part of #3710. We need to change `struct REnv` to fix the former part of the issue.
1 parent 4d3027b commit 0de7eec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mrbgems/mruby-eval/src/eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, con
205205
if (!e) e = c->ci[-1].env;
206206
e = (struct REnv*)mrb_obj_alloc(mrb, MRB_TT_ENV, (struct RClass*)e);
207207
e->cxt.c = c;
208-
e->cioff = c->ci - c->cibase - 1;
208+
e->cioff = c->ci - c->cibase;
209209
e->stack = c->ci->stackent;
210-
MRB_SET_ENV_STACK_LEN(e, c->ci[-1].proc->body.irep->nlocals);
210+
MRB_SET_ENV_STACK_LEN(e, c->ci->proc->body.irep->nlocals);
211211
c->ci->target_class = proc->target_class;
212212
c->ci->env = 0;
213213
proc->env = e;

0 commit comments

Comments
 (0)