From dc99f8d7a5f90eebd4c52cef8d186bf20e2a9912 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 15 Feb 2017 14:19:36 +0100 Subject: [PATCH] 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 ''. --- src/core/commands.c | 5 +++-- 1 file 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