aboutsummaryrefslogtreecommitdiff
path: root/src/tool_getparam.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-05-20 10:51:53 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-05-20 19:04:54 +0200
commit31b77c1877a807ab6184b22ab2310e096536b9b5 (patch)
treeeb2e4bee9ab6207abf74b850cfbc3614af2bcc41 /src/tool_getparam.c
parent0da8441298569dfd714e7b21f74aab373b95d2f7 (diff)
curl: report error for "--no-" on non-boolean options
Reported-by: Olen Andoni Fixes #3906 Closes #3907
Diffstat (limited to 'src/tool_getparam.c')
-rw-r--r--src/tool_getparam.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index b133cb87e..b347121f8 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -515,11 +515,13 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
const char *word = ('-' == flag[0]) ? flag + 2 : flag;
size_t fnam = strlen(word);
int numhits = 0;
+ bool noflagged = FALSE;
if(!strncmp(word, "no-", 3)) {
/* disable this option but ignore the "no-" part when looking for it */
word += 3;
toggle = FALSE;
+ noflagged = TRUE;
}
for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) {
@@ -543,6 +545,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
if(hit < 0) {
return PARAM_OPTION_UNKNOWN;
}
+ if(noflagged && (aliases[hit].desc != ARG_BOOL))
+ /* --no- prefixed an option that isn't boolean! */
+ return PARAM_NO_NOT_BOOLEAN;
}
else {
flag++; /* prefixed with one dash, pass it */