diff options
author | James McCoy <jamessan@jamessan.com> | 2019-06-22 21:17:53 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2019-06-24 06:45:55 -0400 |
commit | 1e4673d167f87ed89be397df936c32547c278d0b (patch) | |
tree | 6f6029073de0641f3c81f67cad84def82bfd2107 /src/nvim/option.c | |
parent | 45bb1757bf7a3c47aef4d6898e9a28218bc80e6c (diff) | |
download | rneovim-1e4673d167f87ed89be397df936c32547c278d0b.tar.gz rneovim-1e4673d167f87ed89be397df936c32547c278d0b.tar.bz2 rneovim-1e4673d167f87ed89be397df936c32547c278d0b.zip |
vim-patch:8.1.1366: using expressions in a modeline is unsafe
Problem: Using expressions in a modeline is unsafe.
Solution: Disallow using expressions in a modeline, unless the
'modelineexpr' option is set. Update help, add more tests.
https://github.com/vim/vim/commit/110289e78195b6d01e1e6ad26ad450de476d41c1
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index a39be0fe96..8dadf926b9 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -253,6 +253,7 @@ typedef struct vimoption { #define P_RWINONLY 0x10000000U ///< only redraw current window #define P_NDNAME 0x20000000U ///< only normal dir name chars allowed #define P_UI_OPTION 0x40000000U ///< send option to remote ui +#define P_MLE 0x80000000U ///< under control of 'modelineexpr' #define HIGHLIGHT_INIT \ "8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \ @@ -1327,6 +1328,11 @@ int do_set( errmsg = (char_u *)_("E520: Not allowed in a modeline"); goto skip; } + if ((flags & P_MLE) && !p_mle) { + errmsg = (char_u *)_( + "E992: Not allowed in a modeline when 'modelineexpr' is off"); + goto skip; + } // In diff mode some options are overruled. This avoids that // 'foldmethod' becomes "marker" instead of "diff" and that // "wrap" gets set. |