diff options
author | Daniel Stenberg <daniel@haxx.se> | 2013-12-09 08:19:04 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2013-12-09 23:30:09 +0100 |
commit | 41d21e460fc0455c01577ea5d88d89fdfe216a10 (patch) | |
tree | 96836f2bdb705d34bdd380fc0538242a511960ed /src/tool_parsecfg.c | |
parent | aadca7f41808a205dcad797959e8c17d3083dacb (diff) | |
download | curl-41d21e460fc0455c01577ea5d88d89fdfe216a10.tar.gz |
parseconfig: warn if unquoted white spaces are detected
Commit 0db811b6 made some existing config files pass on unexpected
values to libcurl that made it somewhat hard to track down what was
really going on.
This code detects unquoted white spaces in the parameter when parsing a
config file as that would be one symptom and it is generally a bad
syntax anyway.
Diffstat (limited to 'src/tool_parsecfg.c')
-rw-r--r-- | src/tool_parsecfg.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index 4d5145bcc..71be83d71 100644 --- a/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c @@ -188,6 +188,24 @@ int parseconfig(const char *filename, while(*line && !ISSPACE(*line)) line++; *line = '\0'; /* zero terminate */ + + /* to detect mistakes better, see if there's data following */ + line++; + /* pass all spaces */ + while(*line && ISSPACE(*line)) + line++; + + switch(*line) { + case '\0': + case '\r': + case '\n': + case '#': /* comment */ + break; + default: + warnf(config, "%s:%d: warning: '%s' uses unquoted white space in the" + " line that may cause side-effects!\n", + filename, lineno, option); + } } if(param && !*param) { |