From 289429cd006f5a2c2e9f4d5ae590b3bf7b5598b6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 22 Mar 2005 08:36:40 -0500 Subject: [PATCH] ENH: Added check for invalid characters in output name. --- Source/cmAddCustomCommandCommand.cxx | 10 ++++++++++ Source/cmAddCustomTargetCommand.cxx | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index ac1f4eb21..138d96f8e 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -171,6 +171,16 @@ bool cmAddCustomCommandCommand::InitialPass(std::vector const& args return false; } + std::string::size_type pos = output.find_first_of("#<>"); + if(pos != output.npos) + { + cmOStringStream msg; + msg << "called with OUTPUT containing a \"" << output[pos] + << "\". This character is not allowed."; + this->SetError(msg.str().c_str()); + return false; + } + // Choose which mode of the command to use. if(source.empty() && output.empty()) { diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ceb5241e0..02ae1615d 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -90,6 +90,16 @@ bool cmAddCustomTargetCommand::InitialPass(std::vector const& args) } } + std::string::size_type pos = args[0].find_first_of("#<>"); + if(pos != args[0].npos) + { + cmOStringStream msg; + msg << "called with target name containing a \"" << args[0][pos] + << "\". This character is not allowed."; + this->SetError(msg.str().c_str()); + return false; + } + // Store the last command line finished. if(!currentLine.empty()) {