diff --git a/ChangeLog b/ChangeLog index e72874dfc2462963eceffa9c22fdec3001348eb5..50f54f00c5e0e1d7503bd0463ab50e30786a249d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-03-10 Benno Schulenberg <bensberg@justemail.net> + * src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic' + commands for the default syntax. This fixes Savannah bug #47323. + 2016-03-09 Benno Schulenberg <bensberg@justemail.net> * src/rcfile.c (parse_syntax): Produce an adequate error message when the syntax name is unquoted. This fixes Savannah bug #47324. diff --git a/src/rcfile.c b/src/rcfile.c index fb1fe4b784cb95d5b89f0d6213cd4f7babe4a3a2..201a3b3046e65b2e36d9fd7b688f8d6b97388d8f 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -329,7 +329,7 @@ void parse_syntax(char *ptr) /* The default syntax should have no associated extensions. */ if (strcmp(endsyntax->name, "default") == 0 && *ptr != '\0') { rcfile_error( - N_("The \"default\" syntax must take no extensions")); + N_("The \"default\" syntax does not accept extensions")); return; } @@ -805,6 +805,13 @@ void grab_and_store(char *ptr, const char *kind, regexlisttype **storage) { regexlisttype *lastthing; + /* The default syntax doesn't take any file matching stuff. */ + if (strcmp(endsyntax->name, "default") == 0 && *ptr != '\0') { + rcfile_error( + N_("The \"default\" syntax does not accept '%s' regexes"), kind); + return; + } + if (!opensyntax) { rcfile_error( N_("A '%s' command requires a preceding 'syntax' command"), kind);