diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-01-04 13:53:51 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-01-04 14:10:29 -0800 |
commit | 51f5983d90c2954ed8ac2f0c90b72917ed568987 (patch) | |
tree | 2613efa54451c84a3a2a7dc8bab983ebc2fd4333 /src | |
parent | b0ad58fdd08795b7b0ad9383bbcc8ddce487e59e (diff) | |
download | vyatta-cfg-51f5983d90c2954ed8ac2f0c90b72917ed568987.tar.gz vyatta-cfg-51f5983d90c2954ed8ac2f0c90b72917ed568987.zip |
workaround for bug 5388
* disallow double quote (") character in config values.
(cherry picked from commit 143d9b4ed9fcf3ac29fd8bc8c6af6bb1921fada8)
Diffstat (limited to 'src')
-rw-r--r-- | src/cli_new.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/cli_new.c b/src/cli_new.c index f88e5c3..87f8e8b 100644 --- a/src/cli_new.c +++ b/src/cli_new.c @@ -2180,15 +2180,20 @@ boolean validate_value(vtw_def *def, char *cp) /* certain characters are not allowed */ { int i = 0; + static const char *disallowed[] = { + "'", "single quote (')", + "\n", "newline", + "\"", "double quote (\")", + NULL, NULL + }; for (i = 0; i < strlen(cp); i++) { - if (cp[i] == '\'') { - OUTPUT_USER("Cannot use the \"'\" (single quote) character " - "in a value string\n"); - return FALSE; - } - if (cp[i] == '\n') { - OUTPUT_USER("Cannot use the newline character in a value string\n"); - return FALSE; + int j = 0; + for (j = 0; disallowed[j]; j += 2) { + if (cp[i] == disallowed[j][0]) { + OUTPUT_USER("Cannot use the %s character in a value string\n", + disallowed[j + 1]); + return FALSE; + } } } } |