Permalink
Browse files

Copy argv from VM stack to avoid use-after-free; fix #3722

  • Loading branch information...
matz committed Jun 27, 2017
1 parent b30eba6 commit 1a3b32343ed9ebf287ae5a0f241877728e62bea5
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/class.c
View
@@ -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;

0 comments on commit 1a3b323

Please sign in to comment.