mirror of
https://github.com/jarro2783/cxxopts.git
synced 2026-01-18 01:11:24 +01:00
Fixes potential segmentation fault in edge cases. (#465)
The options are parsed starting from 1, so check `current < argc` instead of `!=` in the case that `argc` is zero.
This commit is contained in:
@@ -2519,7 +2519,7 @@ OptionParser::parse(int argc, const char* const* argv)
|
||||
|
||||
std::vector<std::string> unmatched;
|
||||
|
||||
while (current != argc)
|
||||
while (current < argc)
|
||||
{
|
||||
if (strcmp(argv[current], "--") == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user