summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-11-30 13:39:16 (GMT)
committerBrad King <brad.king@kitware.com>2010-11-30 13:39:16 (GMT)
commit183d261b116decd6ab09a7d1a522a9ad4add47b4 (patch)
tree6aa84bbf4428188eea0d48ee36cfa2ab1bae6e40
parent63828762a0a716871141552c2b7dc53a93718156 (diff)
downloadCMake-183d261b116decd6ab09a7d1a522a9ad4add47b4.zip
CMake-183d261b116decd6ab09a7d1a522a9ad4add47b4.tar.gz
CMake-183d261b116decd6ab09a7d1a522a9ad4add47b4.tar.bz2
Fix find_* argument parsing crash (#11513)
Previously the command find_path(VAR DOC "") would crash because the argument pre-processing removed the DOC "" arguments but the rest of the parsing assumes at least 2 arguments. Reject the call with an error instead.
-rw-r--r--Source/cmFindBase.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 0416538..d0fe99f 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -164,6 +164,11 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
}
}
}
+ if(args.size() < 2 )
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
this->VariableName = args[0];
if(this->CheckForVariableInCache())
{