diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-03 20:36:11 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-13 12:00:34 -0400 |
| commit | 572627255983b7733b6ad05da52b3e704aae8a2f (patch) | |
| tree | db4262ffb11d38689dad8740a6f8264e3483ef6f /src/nvim/eval/funcs.c | |
| parent | 366e75b6be57220b28f2abc22add19d5df33b5a3 (diff) | |
| download | rneovim-572627255983b7733b6ad05da52b3e704aae8a2f.tar.gz rneovim-572627255983b7733b6ad05da52b3e704aae8a2f.tar.bz2 rneovim-572627255983b7733b6ad05da52b3e704aae8a2f.zip | |
vim-patch:8.2.0507: getbufvar() may get the wrong dictionary
Problem: Getbufvar() may get the wrong dictionary. (David le Blanc)
Solution: Check for empty name. (closes vim/vim#5878)
https://github.com/vim/vim/commit/5259275347667a90fb88d8ea74331f88ad68edfc
Diffstat (limited to 'src/nvim/eval/funcs.c')
| -rw-r--r-- | src/nvim/eval/funcs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 8f16855d0b..21a6904674 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2831,8 +2831,10 @@ static void f_getbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) } else { // Look up the variable. // Let getbufvar({nr}, "") return the "b:" dictionary. - dictitem_T *const v = find_var_in_ht(&buf->b_vars->dv_hashtab, 'b', - varname, strlen(varname), false); + dictitem_T *const v = *varname == NUL + ? (dictitem_T *)&buf->b_bufvar + : find_var_in_ht(&buf->b_vars->dv_hashtab, 'b', + varname, strlen(varname), false); if (v != NULL) { tv_copy(&v->di_tv, rettv); done = true; |