Don't corrupt memory when setting a slice with wrong # of args

Fixes #4881.
This commit is contained in:
Kevin Ballard 2018-04-08 12:19:26 -07:00 committed by David Adam
parent 5d01399586
commit f7ba2a6a00

View file

@ -689,6 +689,7 @@ static int set_var_slices(const wchar_t *cmd, set_cmd_opts_t &opts, const wchar_
if (indexes.size() != static_cast<size_t>(argc)) {
streams.err.append_format(BUILTIN_SET_MISMATCHED_ARGS, cmd, indexes.size(), argc);
return STATUS_INVALID_ARGS;
}
int scope = compute_scope(opts); // calculate the variable scope based on the provided options