Skip to content

Commit

Permalink
Copy argv from VM stack to avoid use-after-free; fix #3722
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jun 27, 2017
1 parent b30eba6 commit 1a3b323
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,9 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if (argc > i) {
*pl = argc-i;
if (*pl > 0) {
*var = ARGV + arg_i;
mrb_value args = mrb_ary_new_from_values(mrb, *pl, ARGV+arg_i);
RARRAY(args)->c = NULL;
*var = (mrb_value*)RARRAY_PTR(args);
}
i = argc;
arg_i += *pl;
Expand Down

0 comments on commit 1a3b323

Please sign in to comment.