Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > 2e29beee24476ca262a978f7f6549ad4 > files > 13

vim-6.2-14.4.100mdk.src.rpm

--- vim62/src/option.c.can-2004-1138	2005-01-05 12:47:03.620267670 -0700
+++ vim62/src/option.c	2005-01-05 12:52:08.072897805 -0700
@@ -292,6 +292,7 @@
 
 #define P_SECURE	0x40000L/* cannot change in modeline or secure mode */
 #define P_GETTEXT	0x80000L/* expand default value with _() */
+#define P_NFNAME	0x200000L/* only normal file name chars allowed */
 
 /*
  * options[] is initialized here.
@@ -403,7 +404,7 @@
     {"backupdir",   "bdir", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP|P_SECURE,
 			    (char_u *)&p_bdir, PV_NONE,
 			    {(char_u *)DFLT_BDIR, (char_u *)0L}},
-    {"backupext",   "bex",  P_STRING|P_VI_DEF,
+    {"backupext",   "bex",  P_STRING|P_VI_DEF|P_NFNAME,
 			    (char_u *)&p_bex, PV_NONE,
 			    {
 #ifdef VMS
@@ -836,7 +837,7 @@
     {"fileformats", "ffs",  P_STRING|P_VIM|P_COMMA|P_NODUP,
 			    (char_u *)&p_ffs, PV_NONE,
 			    {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM}},
-    {"filetype",    "ft",   P_STRING|P_ALLOCED|P_VI_DEF,
+    {"filetype",    "ft",   P_STRING|P_ALLOCED|P_VI_DEF|P_NFNAME,
 #ifdef FEAT_AUTOCMD
 			    (char_u *)&p_ft, PV_FT,
 			    {(char_u *)"", (char_u *)0L}
@@ -1265,7 +1266,7 @@
 			    {(char_u *)0L, (char_u *)0L}
 #endif
 			    },
-    {"keymap",	    "kmp",  P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT,
+    {"keymap",	    "kmp",  P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_RSTAT|P_NFNAME,
 #ifdef FEAT_KEYMAP
 			    (char_u *)&p_keymap, PV_KMAP,
 			    {(char_u *)"", (char_u *)0L}
@@ -1311,7 +1312,7 @@
 			    {(char_u *)NULL,
 #endif
 				(char_u *)0L}},
-    {"langmenu",    "lm",   P_STRING|P_VI_DEF,
+    {"langmenu",    "lm",   P_STRING|P_VI_DEF|P_NFNAME,
 #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG)
 			    (char_u *)&p_lm, PV_NONE,
 #else
@@ -1543,7 +1544,7 @@
 			    {(char_u *)0L, (char_u *)0L}
 #endif
 			    },
-    {"patchmode",   "pm",   P_STRING|P_VI_DEF,
+    {"patchmode",   "pm",   P_STRING|P_VI_DEF|P_NFNAME,
 			    (char_u *)&p_pm, PV_NONE,
 			    {(char_u *)"", (char_u *)0L}},
     {"path",	    "pa",   P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
@@ -1576,7 +1577,7 @@
 			    (char_u *)NULL, PV_NONE,
 #endif
 			    {(char_u *)FALSE, (char_u *)0L}},
-    {"printdevice", "pdev", P_STRING|P_VI_DEF,
+    {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE,
 #ifdef FEAT_PRINTER
 			    (char_u *)&p_pdev, PV_NONE,
 			    {(char_u *)"", (char_u *)0L}
@@ -1962,7 +1963,7 @@
     {"switchbuf",   "swb",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
 			    (char_u *)&p_swb, PV_NONE,
 			    {(char_u *)"", (char_u *)0L}},
-    {"syntax",	    "syn",  P_STRING|P_ALLOCED|P_VI_DEF,
+    {"syntax",	    "syn",  P_STRING|P_ALLOCED|P_VI_DEF|P_NFNAME,
 #ifdef FEAT_SYN_HL
 			    (char_u *)&p_syn, PV_SYN,
 			    {(char_u *)"", (char_u *)0L}
@@ -2067,7 +2068,7 @@
 			    (char_u *)NULL, PV_NONE,
 #endif
 			    {(char_u *)85L, (char_u *)0L}},
-    {"titleold",    NULL,   P_STRING|P_VI_DEF|P_GETTEXT,
+    {"titleold",    NULL,   P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE,
 #ifdef FEAT_TITLE
 			    (char_u *)&p_titleold, PV_NONE,
 			    {(char_u *)N_("Thanks for flying Vim"),
@@ -2301,7 +2302,7 @@
 			    {(char_u *)0L, (char_u *)0L}},
 
 /* terminal output codes */
-#define p_term(sss, vvv)   {sss, NULL, P_STRING|P_VI_DEF|P_RALL, \
+#define p_term(sss, vvv)   {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
 			    (char_u *)&vvv, PV_NONE, \
 			    {(char_u *)"", (char_u *)0L}},
 
@@ -3228,7 +3229,8 @@
 	errmsg = NULL;
 	startarg = arg;		/* remember for error message */
 
-	if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3]))
+	if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
+						&& !(opt_flags & OPT_MODELINE))
 	{
 	    /*
 	     * ":set all"  show all options.
@@ -3244,7 +3246,7 @@
 	    else
 		showoptions(1, opt_flags);
 	}
-	else if (STRNCMP(arg, "termcap", 7) == 0)
+	else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
 	{
 	    showoptions(2, opt_flags);
 	    show_termcodes();
@@ -4507,6 +4509,15 @@
 	errmsg = e_secure;
     }
 
+    /* Check for a "normal" file name in some options.  Disallow a path
+     * separator (slash and/or backslash), wildcards and characters that are
+     * often illegal in a file name. */
+    else if ((options[opt_idx].flags & P_NFNAME)
+				   && vim_strpbrk(*varp, "/\\*?[|<>") != NULL)
+    {
+	errmsg = e_invarg;
+    }
+
     /* 'term' */
     else if (varp == &T_NAME)
     {