From f7ba2a6a00ab127eadd3af99ab16d3a089c1d7f2 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Sun, 8 Apr 2018 12:19:26 -0700 Subject: [PATCH] Don't corrupt memory when setting a slice with wrong # of args Fixes #4881. --- src/builtin_set.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index aff84eec4..f6cc9ddf9 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -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(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