From c111e091336b67b9aa5abddda9cf381e6ab49a04 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sat, 4 Mar 2017 21:36:01 +0100 Subject: [PATCH] Merge pull request #652 from LemonBoy/trailing-arg Properly check the command arguments in tail place. --- 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