Skip to content

Commit

Permalink
Fix argument count handling in Command::InitArguments to prevent inte…
Browse files Browse the repository at this point in the history
…ger overflow (#36414)

* Fix unsigned overflow in Command::InitArguments with zero args

* Update format
  • Loading branch information
BoB13-Matter authored Nov 11, 2024
1 parent d099b0b commit 882b76e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/chip-tool/commands/common/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ bool Command::InitArguments(int argc, char ** argv)
{
optionalArgsCount++;
}
else if (argvExtraArgsCount == 0)
{
mandatoryArgsCount++;
}
else
{
mandatoryArgsCount++;
Expand Down

0 comments on commit 882b76e

Please sign in to comment.