aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index ae1a2b1b24..6ed4989a4c 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -242,6 +242,7 @@ typedef struct vimoption {
#define P_NO_DEF_EXP 0x8000000U ///< Do not expand default value.
#define P_RWINONLY 0x10000000U ///< only redraw current window
+#define P_NDNAME 0x20000000U ///< only normal dir name chars allowed
#define HIGHLIGHT_INIT \
"8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \
@@ -2454,11 +2455,13 @@ did_set_string_option (
if ((secure || sandbox != 0)
&& (options[opt_idx].flags & P_SECURE)) {
errmsg = e_secure;
- } else if ((options[opt_idx].flags & P_NFNAME)
- && vim_strpbrk(*varp, (char_u *)"/\\*?[|;&<>\r\n") != NULL) {
- // 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, (char_u *)"/\\*?[|;&<>\r\n") != NULL))
+ || ((options[opt_idx].flags & P_NDNAME)
+ && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)) {
+ // Check for a "normal" directory or file name in some options. Disallow a
+ // path separator (slash and/or backslash), wildcards and characters that
+ // are often illegal in a file name.
errmsg = e_invarg;
}
/* 'backupcopy' */