summaryrefslogtreecommitdiff
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-11 22:00:11 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-11 22:00:11 +0100
commit05c00c038bc16e862e17f9e5c8d5a72af6cf7788 (patch)
tree4c7015c7adc01116b60c8a6b19f71d7335f38b93 /src/evalfunc.c
parent5a6698169d10833abad88c98e5a332ddde5d110d (diff)
downloadvim-git-05c00c038bc16e862e17f9e5c8d5a72af6cf7788.tar.gz
patch 8.1.0897: can modify a:000 when using a referencev8.1.0897
Problem: Can modify a:000 when using a reference. Solution: Make check for locked variable stricter. (Ozaki Kiichi, closes #3930)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 4c0347022..6982ddfe1 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1248,7 +1248,7 @@ f_add(typval_T *argvars, typval_T *rettv)
if (argvars[0].v_type == VAR_LIST)
{
if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock,
+ && !var_check_lock(l->lv_lock,
(char_u *)N_("add() argument"), TRUE)
&& list_append_tv(l, &argvars[1]) == OK)
copy_tv(&argvars[0], rettv);
@@ -1256,7 +1256,7 @@ f_add(typval_T *argvars, typval_T *rettv)
else if (argvars[0].v_type == VAR_BLOB)
{
if ((b = argvars[0].vval.v_blob) != NULL
- && !tv_check_lock(b->bv_lock,
+ && !var_check_lock(b->bv_lock,
(char_u *)N_("add() argument"), TRUE))
{
int error = FALSE;
@@ -3579,7 +3579,7 @@ f_extend(typval_T *argvars, typval_T *rettv)
l1 = argvars[0].vval.v_list;
l2 = argvars[1].vval.v_list;
- if (l1 != NULL && !tv_check_lock(l1->lv_lock, arg_errmsg, TRUE)
+ if (l1 != NULL && !var_check_lock(l1->lv_lock, arg_errmsg, TRUE)
&& l2 != NULL)
{
if (argvars[2].v_type != VAR_UNKNOWN)
@@ -3615,7 +3615,7 @@ f_extend(typval_T *argvars, typval_T *rettv)
d1 = argvars[0].vval.v_dict;
d2 = argvars[1].vval.v_dict;
- if (d1 != NULL && !tv_check_lock(d1->dv_lock, arg_errmsg, TRUE)
+ if (d1 != NULL && !var_check_lock(d1->dv_lock, arg_errmsg, TRUE)
&& d2 != NULL)
{
/* Check the third argument. */
@@ -7266,8 +7266,9 @@ f_insert(typval_T *argvars, typval_T *rettv)
}
else if (argvars[0].v_type != VAR_LIST)
semsg(_(e_listblobarg), "insert()");
- else if ((l = argvars[0].vval.v_list) != NULL && !tv_check_lock(l->lv_lock,
- (char_u *)N_("insert() argument"), TRUE))
+ else if ((l = argvars[0].vval.v_list) != NULL
+ && !var_check_lock(l->lv_lock,
+ (char_u *)N_("insert() argument"), TRUE))
{
if (argvars[2].v_type != VAR_UNKNOWN)
before = (long)tv_get_number_chk(&argvars[2], &error);
@@ -9698,7 +9699,7 @@ f_remove(typval_T *argvars, typval_T *rettv)
if (argvars[2].v_type != VAR_UNKNOWN)
semsg(_(e_toomanyarg), "remove()");
else if ((d = argvars[0].vval.v_dict) != NULL
- && !tv_check_lock(d->dv_lock, arg_errmsg, TRUE))
+ && !var_check_lock(d->dv_lock, arg_errmsg, TRUE))
{
key = tv_get_string_chk(&argvars[1]);
if (key != NULL)
@@ -9781,7 +9782,7 @@ f_remove(typval_T *argvars, typval_T *rettv)
else if (argvars[0].v_type != VAR_LIST)
semsg(_(e_listdictblobarg), "remove()");
else if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock, arg_errmsg, TRUE))
+ && !var_check_lock(l->lv_lock, arg_errmsg, TRUE))
{
idx = (long)tv_get_number_chk(&argvars[1], &error);
if (error)
@@ -10128,7 +10129,7 @@ f_reverse(typval_T *argvars, typval_T *rettv)
if (argvars[0].v_type != VAR_LIST)
semsg(_(e_listblobarg), "reverse()");
else if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock,
+ && !var_check_lock(l->lv_lock,
(char_u *)N_("reverse() argument"), TRUE))
{
li = l->lv_last;
@@ -12112,7 +12113,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
else
{
l = argvars[0].vval.v_list;
- if (l == NULL || tv_check_lock(l->lv_lock,
+ if (l == NULL || var_check_lock(l->lv_lock,
(char_u *)(sort ? N_("sort() argument") : N_("uniq() argument")),
TRUE))
goto theend;