Permalink
Browse files

Add assert for Cmd::Args::Argv() out of bounds

  • Loading branch information...
slipher committed Jan 1, 2019
1 parent fe1b38d commit deb18caa3d7e77032f6c32d5e7f4f4b697da5fda
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/common/Command.cpp
@@ -377,6 +377,9 @@ namespace Cmd {
}

const std::string& Args::Argv(int argNum) const {
// Cmd_Argv() returns an empty string for an out of bounds index.
// Try to catch porting issues with an assert.
ASSERT_LT(static_cast<size_t>(argNum), Argc());
return args[argNum];
}

0 comments on commit deb18ca

Please sign in to comment.