fix RC file CHOOSE '[section] #comment'
Two years ago I modified the parsing for [section] labels for the config file's CHOOSE directive to allow end-of-line comments, but the code used had a logic error (don't think I can blame it on copy+paste). It looked for '#' after ']' but allowed anything-- rather than just spaces--in between. "[section-name]abc#comment" would become "section-name" as if the trailing junk hadn't been present. Parsing that should produce "section-name]abc" and get rejected as invalid.
This commit is contained in:
+4
-3
@@ -2317,8 +2317,8 @@ free_config_sections(void)
|
|||||||
with spaces optional; returns pointer to "anything-except..." (with
|
with spaces optional; returns pointer to "anything-except..." (with
|
||||||
trailing " ] #..." stripped) if ok, otherwise Null */
|
trailing " ] #..." stripped) if ok, otherwise Null */
|
||||||
static char *
|
static char *
|
||||||
is_config_section(char *str) /* trailing spaces will be stripped,
|
is_config_section(
|
||||||
']' too iff result is good */
|
char *str) /* trailing spaces are stripped, ']' too iff result is good */
|
||||||
{
|
{
|
||||||
char *a, *c, *z;
|
char *a, *c, *z;
|
||||||
|
|
||||||
@@ -2332,7 +2332,8 @@ is_config_section(char *str) /* trailing spaces will be stripped,
|
|||||||
z = index(a, ']');
|
z = index(a, ']');
|
||||||
if (!z)
|
if (!z)
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
for (c = z + 1; *c && *c != '#'; ++c)
|
/* comment, if present, can be preceded by spaces */
|
||||||
|
for (c = z + 1; *c == ' '; ++c)
|
||||||
continue;
|
continue;
|
||||||
if (*c && *c != '#')
|
if (*c && *c != '#')
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user