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

@@ -6364,7 +6364,7 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
if (evaluate) { if (evaluate) {
if (len == 0) { if (len == 0) {
return FAIL; // Can't be an environment variable. return FAIL; // Invalid empty name.
} }
cc = name[len]; cc = name[len];
name[len] = NUL; name[len] = NUL;
@@ -8145,12 +8145,18 @@ static void f_eval(typval_T *argvars, typval_T *rettv)
if (s != NULL) if (s != NULL)
s = skipwhite(s); s = skipwhite(s);
char_u *p = s;
if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) { 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->v_type = VAR_NUMBER;
rettv->vval.v_number = 0; rettv->vval.v_number = 0;
} else if (*s != NUL) } else if (*s != NUL) {
EMSG(_(e_trailing)); EMSG(_(e_trailing));
} }
}
/* /*
* "eventhandler()" function * "eventhandler()" function

View File

@@ -209,7 +209,7 @@ static int included_patches[] = {
//577, //577,
//576, //576,
//575, //575,
//574, 574,
//573, //573,
572, 572,
//571 NA //571 NA