mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Copy argv from VM stack to avoid use-after-free; fix #3722
This commit is contained in:
+3
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user