From 938054bdb83632bb516de2f755a31696fa226bac Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 9 Aug 2022 12:47:56 +0200 Subject: [PATCH] command/all: fix off-by-one bug in parameter count check --- src/command/AllCommands.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index d9b9bada9..30f698640 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -409,15 +409,15 @@ command_process(Client &client, unsigned num, char *line) noexcept StaticVector 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); }