0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 7.4.1768

Problem:    Arguments of setqflist() are not checked properly.
Solution:   Add better checks, add a test. (Nikolai Pavlov, Hirohito Higashi,
            closes #661)
This commit is contained in:
Bram Moolenaar
2016-04-21 19:38:07 +02:00
parent 4adfaabfe7
commit d106e5ba7f
3 changed files with 107 additions and 11 deletions

View File

@@ -98,6 +98,7 @@ static char *e_listarg = N_("E686: Argument of %s must be a List");
static char *e_listdictarg = N_("E712: Argument of %s must be a List or Dictionary");
static char *e_listreq = N_("E714: List required");
static char *e_dictreq = N_("E715: Dictionary 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_("E122: Function %s already exists, add ! to replace it");
@@ -18280,8 +18281,9 @@ set_qf_ll_list(
typval_T *rettv)
{
#ifdef FEAT_QUICKFIX
static char *e_invact = N_("E927: Invalid action: '%s'");
char_u *act;
int action = ' ';
int action = 0;
#endif
rettv->vval.v_number = -1;
@@ -18298,11 +18300,17 @@ set_qf_ll_list(
act = get_tv_string_chk(action_arg);
if (act == NULL)
return; /* type error; errmsg already given */
if (*act == 'a' || *act == 'r')
if ((*act == 'a' || *act == 'r' || *act == ' ') && act[1] == NUL)
action = *act;
else
EMSG2(_(e_invact), act);
}
else if (action_arg->v_type == VAR_UNKNOWN)
action = ' ';
else
EMSG(_(e_stringreq));
if (l != NULL && set_errorlist(wp, l, action,
if (l != NULL && action && set_errorlist(wp, l, action,
(char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
rettv->vval.v_number = 0;
}