command/all: fix off-by-one bug in parameter count check

This commit is contained in:
Max Kellermann 2022-08-09 12:47:56 +02:00
parent d0909adf6b
commit 938054bdb8

View File

@ -409,15 +409,15 @@ command_process(Client &client, unsigned num, char *line) noexcept
StaticVector<const char *, COMMAND_ARGV_MAX> argv;
while (true) {
char *a = tokenizer.NextParam();
if (a == nullptr)
break;
if (argv.full()) {
r.Error(ACK_ERROR_ARG, "Too many arguments");
return CommandResult::ERROR;
}
char *a = tokenizer.NextParam();
if (a == nullptr)
break;
argv.push_back(a);
}