summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2017-02-15 14:19:36 +0100
committerAilin Nemui <ailin@z30a.localdomain>2017-03-04 21:37:13 +0100
commitdc99f8d7a5f90eebd4c52cef8d186bf20e2a9912 (patch)
tree2b052ce59e55739073f92ee8917c7701c2135a23 /src
parent7ef22687f9291ef10072cc55bc64e3db3ad5a546 (diff)
downloadirssi-dc99f8d7a5f90eebd4c52cef8d186bf20e2a9912.zip
Properly check the command arguments in tail place.
A command requiring an argument and given in tail position would not raise an error but silently set the value to the empty string ''.
Diffstat (limited to 'src')
-rw-r--r--src/core/commands.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/commands.c b/src/core/commands.c
index 607baf77..8e21a88a 100644
--- a/src/core/commands.c
+++ b/src/core/commands.c
@@ -567,13 +567,14 @@ static int get_cmd_options(char **data, int ignore_unknown,
option = NULL; pos = -1;
for (;;) {
- if (**data == '-') {
+ if (**data == '\0' || **data == '-') {
if (option != NULL && *optlist[pos] == '+') {
/* required argument missing! */
*data = optlist[pos] + 1;
return CMDERR_OPTION_ARG_MISSING;
}
-
+ }
+ if (**data == '-') {
(*data)++;
if (**data == '-' && (*data)[1] == ' ') {
/* -- option means end of options even