File: patch-8.1.1046-the-secure-variable-is-used-inconsistently.patch

package info (click to toggle)
vim 2%3A8.0.0197-4%2Bdeb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 60,600 kB
  • sloc: ansic: 320,650; cpp: 4,144; makefile: 3,536; perl: 1,179; awk: 715; sh: 682; xml: 526; lisp: 501; cs: 458; python: 410; asm: 114; csh: 6
file content (64 lines) | stat: -rw-r--r-- 1,884 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 24 Mar 2019 14:02:04 +0100
Subject: 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.

(cherry picked from commit 82b033eff82d3ed0da77fd5f5a1c023766acabba)

Signed-off-by: James McCoy <jamessan@debian.org>
---
 src/buffer.c  | 2 +-
 src/option.c  | 9 ++++-----
 src/version.c | 2 ++
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/buffer.c b/src/buffer.c
index b5a47d6..b02f5a9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5477,7 +5477,7 @@ chk_modeline(
 		current_SID = SID_MODELINE;
 #endif
 		// 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/option.c b/src/option.c
index afba466..cf65d5d 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4991,13 +4991,12 @@ 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)
 #ifdef HAVE_SANDBOX
-				    || sandbox != 0
+				  || sandbox != 0
 #endif
-				    || (opt_flags & OPT_MODELINE)
-				    || (!value_is_replaced && (*p & P_INSECURE)))
-				++secure;
+				  || (!value_is_replaced && (*p & P_INSECURE)))
+				secure = 1;
 
 			    // Handle side effects, and set the global value
 			    // for ":set" on local options. Note: when setting
diff --git a/src/version.c b/src/version.c
index beba433..81ea1b4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -1195,6 +1195,8 @@ static int included_patches[] =
  */
 static char *(extra_patches[]) =
 {   /* Add your patch description below this line */
+/**/
+    "8.1.1046",
 /**/
     "8.1.0613",
 /**/