patch 8.1.0613: when executing an insecure function the secure flag is stuck
Problem: When executing an insecure function the secure flag is stuck.
(Gabriel Barta)
Solution: Restore "secure" instead of decrementing it. (closes #3705)
diff --git a/src/option.c b/src/option.c
index f8e91e4..3ab355f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5214,7 +5214,7 @@
{
long_u *p = insecure_flag(opt_idx, opt_flags);
- int did_inc_secure = FALSE;
+ int secure_saved = secure;
// When an option is set in the sandbox, from a
// modeline or in secure mode, then deal with side
@@ -5227,21 +5227,18 @@
#endif
|| (opt_flags & OPT_MODELINE)
|| (!value_is_replaced && (*p & P_INSECURE)))
- {
- did_inc_secure = TRUE;
++secure;
- }
- // Handle side effects, and set the global value for
- // ":set" on local options. Note: when setting 'syntax'
- // or 'filetype' autocommands may be triggered that can
- // cause havoc.
- errmsg = did_set_string_option(opt_idx, (char_u **)varp,
+ // Handle side effects, and set the global value
+ // for ":set" on local options. Note: when setting
+ // 'syntax' or 'filetype' autocommands may be
+ // triggered that can cause havoc.
+ errmsg = did_set_string_option(
+ opt_idx, (char_u **)varp,
new_value_alloced, oldval, errbuf,
opt_flags, &value_checked);
- if (did_inc_secure)
- --secure;
+ secure = secure_saved;
}
#if defined(FEAT_EVAL)