From 29d7a597115b692a7e2e39d213b87ac566444a5c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 12 Dec 2016 11:33:51 -0500 Subject: vim-patch:7.4.1768 Problem: Arguments of setqflist() are not checked properly. Solution: Add better checks, add a test. (Nikolai Pavlov, Hirohito Higashi, closes vim/vim#661) https://github.com/vim/vim/commit/d106e5ba7f10f0d2a14eaefe5d78405044416cb9 --- src/nvim/eval.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 39e121eb53..45364a1666 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -158,7 +158,7 @@ static char *e_listdictarg = N_( static char *e_emptykey = N_("E713: Cannot use empty key for Dictionary"); static char *e_listreq = N_("E714: List required"); static char *e_dictreq = N_("E715: Dictionary required"); -static char *e_strreq = N_("E114: String required"); +static char *e_stringreq = N_("E928: String required"); static char *e_toomanyarg = N_("E118: Too many arguments for function: %s"); static char *e_dictkey = N_("E716: Key not present in Dictionary: %s"); static char *e_funcexts = N_( @@ -14996,6 +14996,7 @@ static void f_setline(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv) FUNC_ATTR_NONNULL_ARG(2, 3) { + static char *e_invact = N_("E927: Invalid action: '%s'"); char_u *title = NULL; int action = ' '; rettv->vval.v_number = -1; @@ -15011,13 +15012,17 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv) // Option argument was not given. goto skip_args; } else if (action_arg->v_type != VAR_STRING) { - EMSG(_(e_strreq)); + EMSG(_(e_stringreq)); return; } char_u *act = get_tv_string_chk(action_arg); - if (*act == 'a' || *act == 'r') { + if ((*act == 'a' || *act == 'r' || *act == ' ') && act[1] == NUL) { action = *act; } + else { + EMSG2(_(e_invact), act); + return; + } typval_T *title_arg = &args[2]; if (title_arg->v_type == VAR_UNKNOWN) { -- cgit From 3224ade9c3b6e339083ab9e66ce3d3f32e050e09 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 14 Dec 2016 16:16:37 -0500 Subject: lint --- src/nvim/eval.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 45364a1666..bdbd77337d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -15018,8 +15018,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv) char_u *act = get_tv_string_chk(action_arg); if ((*act == 'a' || *act == 'r' || *act == ' ') && act[1] == NUL) { action = *act; - } - else { + } else { EMSG2(_(e_invact), act); return; } -- cgit