1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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 ''.
This commit is contained in:
LemonBoy 2017-02-15 14:19:36 +01:00 committed by Ailin Nemui
parent 7ef22687f9
commit dc99f8d7a5

View File

@ -567,13 +567,14 @@ static int get_cmd_options(char **data, int ignore_unknown,
option = NULL; pos = -1; option = NULL; pos = -1;
for (;;) { for (;;) {
if (**data == '-') { if (**data == '\0' || **data == '-') {
if (option != NULL && *optlist[pos] == '+') { if (option != NULL && *optlist[pos] == '+') {
/* required argument missing! */ /* required argument missing! */
*data = optlist[pos] + 1; *data = optlist[pos] + 1;
return CMDERR_OPTION_ARG_MISSING; return CMDERR_OPTION_ARG_MISSING;
} }
}
if (**data == '-') {
(*data)++; (*data)++;
if (**data == '-' && (*data)[1] == ' ') { if (**data == '-' && (*data)[1] == ' ') {
/* -- option means end of options even /* -- option means end of options even