From 339d5922d9baef98c3a19fd0712badeb3d9e2996 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Mar 2011 17:47:31 -0400 Subject: [PATCH] Validate custom command arguments (#11963) Reject quoted commands immediately with an error message instead of allowing a later assertion failure. --- Source/cmMakefile.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e14e44d54..c36dd05b1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -893,6 +893,20 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, return; } + // Validate custom commands. TODO: More strict? + for(cmCustomCommandLines::const_iterator i=commandLines.begin(); + i != commandLines.end(); ++i) + { + cmCustomCommandLine const& cl = *i; + if(!cl.empty() && !cl[0].empty() && cl[0][0] == '"') + { + cmOStringStream e; + e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n"; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } + } + // Choose a source file on which to store the custom command. cmSourceFile* file = 0; if(main_dependency && main_dependency[0])