1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04: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;
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