vim-patch:7.4.574 #2539

Problem:    No error for eval('$').
Solution:   Check for empty name. (Yasuhiro Matsumoto)

https://github.com/vim/vim/commit/v7-4-574
This commit is contained in:
Bastian Winkler
2015-04-29 20:11:15 +02:00
committed by Michael Reed
parent 0d6ce4c770
commit 115f137b12
2 changed files with 10 additions and 4 deletions

View File

@@ -6363,8 +6363,8 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
len = get_env_len(arg);
if (evaluate) {
if (len == 0) {
return FAIL; // Can't be an environment variable.
if (len == 0) {
return FAIL; // Invalid empty name.
}
cc = name[len];
name[len] = NUL;
@@ -8145,11 +8145,17 @@ static void f_eval(typval_T *argvars, typval_T *rettv)
if (s != NULL)
s = skipwhite(s);
char_u *p = s;
if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) {
if (p != NULL && !aborting()) {
EMSG2(_(e_invexpr2), p);
}
need_clr_eos = FALSE;
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
} else if (*s != NUL)
} else if (*s != NUL) {
EMSG(_(e_trailing));
}
}
/*