From ad8bba10c493a2ae50592d9be405736e6b018d19 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 5 May 2019 11:38:34 -0400 Subject: [PATCH] vim-patch:8.1.1046: the "secure" variable is used inconsistently Problem: the "secure" variable is used inconsistently. (Justin M. Keyes) Solution: Set it to one instead of incrementing. https://github.com/vim/vim/commit/82b033eff82d3ed0da77fd5f5a1c023766acabba --- src/nvim/buffer.c | 2 +- src/nvim/option.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index af1a955967..e3e77d65b0 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4928,7 +4928,7 @@ chk_modeline ( save_SID = current_SID; current_SID = SID_MODELINE; // Make sure no risky things are executed as a side effect. - ++secure; + secure = 1; retval = do_set(s, OPT_MODELINE | OPT_LOCAL | flags); diff --git a/src/nvim/option.c b/src/nvim/option.c index 48e230c8ee..b6a9b7b322 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1796,11 +1796,10 @@ do_set ( // effects in secure mode. Also when the value was // set with the P_INSECURE flag and is not // completely replaced. - if (secure + if ((opt_flags & OPT_MODELINE) || sandbox != 0 - || (opt_flags & OPT_MODELINE) || (!value_is_replaced && (*p & P_INSECURE))) { - secure++; + secure = 1; } // Handle side effects, and set the global value