stage 4 package updates
[hdw-linux/hdw-linux.git] / packages / hackbard / vim / security.patch
1 --- vim63.orig/runtime/doc/options.txt  2004-06-07 09:05:19.000000000 +0000
2 +++ vim63/runtime/doc/options.txt       2004-12-30 11:00:23.971481608 +0000
3 @@ -1,4 +1,4 @@
4 -*options.txt*  For Vim version 6.3.  Last change: 2004 Jun 01
5 +*options.txt*  For Vim version 6.3.  Last change: 2004 Dec 09
6  
7  
8                   VIM REFERENCE MANUAL    by Bram Moolenaar
9 @@ -139,6 +139,9 @@
10  (the ^[ is a real <Esc> here, use CTRL-V <Esc> to enter it)
11  The advantage over a mapping is that it works in all situations.
12  
13 +The t_xx options cannot be set from a |modeline| or in the |sandbox|, for
14 +security reasons.
15 +
16  The listing from ":set" looks different from Vi.  Long string options are put
17  at the end of the list.  The number of options is quite large. The output of
18  "set all" probably does not fit on the screen, causing Vim to give the
19 @@ -945,6 +948,7 @@
20         accidentally overwriting existing files with a backup file.  You might
21         prefer using ".bak", but make sure that you don't have files with
22         ".bak" that you want to keep.
23 +       Only normal file name characters can be used, "/\*?[|<>" are illegal.
24  
25                                                 *'backupskip'* *'bsk'*
26  'backupskip' 'bsk'     string  (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*")
27 @@ -2407,6 +2411,7 @@
28         type that is actually stored with the file.
29         This option is not copied to another buffer, independent of the 's' or
30         'S' flag in 'cpoptions'.
31 +       Only normal file name characters can be used, "/\*?[|<>" are illegal.
32  
33                                                 *'fillchars'* *'fcs'*
34  'fillchars' 'fcs'      string  (default "vert:|,fold:-")
35 @@ -3599,6 +3604,7 @@
36         Setting this option to a valid keymap name has the side effect of
37         setting 'iminsert' to one, so that the keymap becomes effective.
38         'imsearch' is also set to one, unless it was -1
39 +       Only normal file name characters can be used, "/\*?[|<>" are illegal.
40  
41                                         *'keymodel'* *'km'*
42  'keymodel' 'km'                string  (default "")
43 @@ -3690,6 +3696,7 @@
44         matter what $LANG is set to: >
45                 :set langmenu=nl_NL.ISO_8859-1
46  <      When 'langmenu' is empty, |v:lang| is used.
47 +       Only normal file name characters can be used, "/\*?[|<>" are illegal.
48         If your $LANG is set to a non-English language but you do want to use
49         the English menus: >
50                 :set langmenu=none
51 @@ -4310,6 +4317,7 @@
52         Using 'patchmode' for compressed files appends the extension at the
53         end (e.g., "file.gz.orig"), thus the resulting name isn't always
54         recognized as a compressed file.
55 +       Only normal file name characters can be used, "/\*?[|<>" are illegal.
56  
57                                         *'path'* *'pa'* *E343* *E345* *E347*
58  'path' 'pa'            string  (default on Unix: ".,/usr/include,,"
59 @@ -4424,6 +4432,8 @@
60         in the standard printer dialog.
61         If the option is empty, then vim will use the system default printer
62         for ":hardcopy!"
63 +       This option cannot be set from a |modeline| or in the |sandbox|, for
64 +       security reasons.
65  
66                                         *'printencoding'* *'penc'* *E620*
67  'printencoding' 'penc' String  (default empty, except for:
68 @@ -5711,6 +5721,7 @@
69         Syntax autocommand event is triggered with the value as argument.
70         This option is not copied to another buffer, independent of the 's' or
71         'S' flag in 'cpoptions'.
72 +       Only normal file name characters can be used, "/\*?[|<>" are illegal.
73  
74                                         *'tabstop'* *'ts'*
75  'tabstop' 'ts'         number  (default 8)
76 @@ -6089,6 +6100,8 @@
77         This option will be used for the window title when exiting Vim if the
78         original title cannot be restored.  Only happens if 'title' is on or
79         'titlestring' is not empty.
80 +       This option cannot be set from a |modeline| or in the |sandbox|, for
81 +       security reasons.
82                                                 *'titlestring'*
83  'titlestring'          string  (default "")
84                         global
85 --- vim63.orig/src/option.c     2004-05-15 10:20:06.000000000 +0000
86 +++ vim63/src/option.c  2004-12-30 11:00:23.966482368 +0000
87 @@ -293,6 +293,7 @@
88  #define P_SECURE       0x40000L/* cannot change in modeline or secure mode */
89  #define P_GETTEXT      0x80000L/* expand default value with _() */
90  #define P_NOGLOB       0x100000L/* do not use local value for global vimrc */
91 +#define P_NFNAME       0x200000L/* only normal file name chars allowed */
92  
93  /*
94   * options[] is initialized here.
95 @@ -413,7 +414,7 @@
96      {"backupdir",   "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
97                             (char_u *)&p_bdir, PV_NONE,
98                             {(char_u *)DFLT_BDIR, (char_u *)0L}},
99 -    {"backupext",   "bex",  P_STRING|P_VI_DEF,
100 +    {"backupext",   "bex",  P_STRING|P_VI_DEF|P_NFNAME,
101                             (char_u *)&p_bex, PV_NONE,
102                             {
103  #ifdef VMS
104 @@ -846,7 +847,7 @@
105      {"fileformats", "ffs",  P_STRING|P_VIM|P_COMMA|P_NODUP,
106                             (char_u *)&p_ffs, PV_NONE,
107                             {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM}},
108 -    {"filetype",    "ft",   P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
109 +    {"filetype",    "ft",   P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
110  #ifdef FEAT_AUTOCMD
111                             (char_u *)&p_ft, PV_FT,
112                             {(char_u *)"", (char_u *)0L}
113 @@ -1284,7 +1285,7 @@
114                             {(char_u *)0L, (char_u *)0L}
115  #endif
116                             },
117 -    {"keymap",     "kmp",  P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT,
118 +    {"keymap",     "kmp",  P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME,
119  #ifdef FEAT_KEYMAP
120                             (char_u *)&p_keymap, PV_KMAP,
121                             {(char_u *)"", (char_u *)0L}
122 @@ -1330,7 +1331,7 @@
123                             {(char_u *)NULL,
124  #endif
125                                 (char_u *)0L}},
126 -    {"langmenu",    "lm",   P_STRING|P_VI_DEF,
127 +    {"langmenu",    "lm",   P_STRING|P_VI_DEF|P_NFNAME,
128  #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
129                             (char_u *)&p_lm, PV_NONE,
130  #else
131 @@ -1562,7 +1563,7 @@
132                             {(char_u *)0L, (char_u *)0L}
133  #endif
134                             },
135 -    {"patchmode",   "pm",   P_STRING|P_VI_DEF,
136 +    {"patchmode",   "pm",   P_STRING|P_VI_DEF|P_NFNAME,
137                             (char_u *)&p_pm, PV_NONE,
138                             {(char_u *)"", (char_u *)0L}},
139      {"path",       "pa",   P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
140 @@ -1595,7 +1596,7 @@
141                             (char_u *)NULL, PV_NONE,
142  #endif
143                             {(char_u *)FALSE, (char_u *)0L}},
144 -    {"printdevice", "pdev", P_STRING|P_VI_DEF,
145 +    {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE,
146  #ifdef FEAT_PRINTER
147                             (char_u *)&p_pdev, PV_NONE,
148                             {(char_u *)"", (char_u *)0L}
149 @@ -1981,7 +1982,7 @@
150      {"switchbuf",   "swb",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
151                             (char_u *)&p_swb, PV_NONE,
152                             {(char_u *)"", (char_u *)0L}},
153 -    {"syntax",     "syn",  P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
154 +    {"syntax",     "syn",  P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
155  #ifdef FEAT_SYN_HL
156                             (char_u *)&p_syn, PV_SYN,
157                             {(char_u *)"", (char_u *)0L}
158 @@ -2086,7 +2087,7 @@
159                             (char_u *)NULL, PV_NONE,
160  #endif
161                             {(char_u *)85L, (char_u *)0L}},
162 -    {"titleold",    NULL,   P_STRING|P_VI_DEF|P_GETTEXT,
163 +    {"titleold",    NULL,   P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE,
164  #ifdef FEAT_TITLE
165                             (char_u *)&p_titleold, PV_NONE,
166                             {(char_u *)N_("Thanks for flying Vim"),
167 @@ -2321,7 +2322,7 @@
168                             {(char_u *)0L, (char_u *)0L}},
169  
170  /* terminal output codes */
171 -#define p_term(sss, vvv)   {sss, NULL, P_STRING|P_VI_DEF|P_RALL, \
172 +#define p_term(sss, vvv)   {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
173                             (char_u *)&vvv, PV_NONE, \
174                             {(char_u *)"", (char_u *)0L}},
175  
176 @@ -3302,7 +3303,8 @@
177         errmsg = NULL;
178         startarg = arg;         /* remember for error message */
179  
180 -       if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3]))
181 +       if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
182 +                                               && !(opt_flags & OPT_MODELINE))
183         {
184             /*
185              * ":set all"  show all options.
186 @@ -3318,7 +3320,7 @@
187             else
188                 showoptions(1, opt_flags);
189         }
190 -       else if (STRNCMP(arg, "termcap", 7) == 0)
191 +       else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
192         {
193             showoptions(2, opt_flags);
194             show_termcodes();
195 @@ -4604,6 +4606,15 @@
196         errmsg = e_secure;
197      }
198  
199 +    /* Check for a "normal" file name in some options.  Disallow a path
200 +     * separator (slash and/or backslash), wildcards and characters that are
201 +     * often illegal in a file name. */
202 +    else if ((options[opt_idx].flags & P_NFNAME)
203 +                                  && vim_strpbrk(*varp, "/\\*?[|<>") != NULL)
204 +    {
205 +       errmsg = e_invarg;
206 +    }
207 +
208      /* 'term' */
209      else if (varp == &T_NAME)
210      {