diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2006-03-21 22:47:11 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2006-03-21 22:47:11 (GMT) |
commit | d82c97978727f270d8f5212d8ad9de9d8ca87b5d (patch) | |
tree | ea164870eb5eb83b47a4ac3e9354fb788e15e38f /Source/kwsys | |
parent | 07a0f51ffda66d4253334946ed99a13784374fdd (diff) | |
download | CMake-d82c97978727f270d8f5212d8ad9de9d8ca87b5d.zip CMake-d82c97978727f270d8f5212d8ad9de9d8ca87b5d.tar.gz CMake-d82c97978727f270d8f5212d8ad9de9d8ca87b5d.tar.bz2 |
ENH: the arguments to this function were not checked in a robust way
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index f54318c..19c55a2 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1918,7 +1918,7 @@ kwsys_stl::string SystemTools::FindProgram( const kwsys_stl::vector<kwsys_stl::string>& userPaths, bool no_system_path) { - if(!nameIn) + if(!nameIn || !*nameIn) { return ""; } @@ -2245,9 +2245,9 @@ bool SystemTools::FindProgramPath(const char* argv0, const char* installPrefix ) { kwsys_stl::vector<kwsys_stl::string> failures; - kwsys_stl::string self = argv0; + kwsys_stl::string self = argv0 ? argv0 : ""; + failures.push_back(self); SystemTools::ConvertToUnixSlashes(self); - failures.push_back(argv0); self = SystemTools::FindProgram(self.c_str()); if(!SystemTools::FileExists(self.c_str())) { @@ -2279,8 +2279,16 @@ bool SystemTools::FindProgramPath(const char* argv0, { failures.push_back(self); kwsys_ios::ostringstream msg; - msg << "Can not find the command line program " << exeName << "\n"; - msg << " argv[0] = \"" << argv0 << "\"\n"; + msg << "Can not find the command line program "; + if (exeName) + { + msg << exeName; + } + msg << "\n"; + if (argv0) + { + msg << " argv[0] = \"" << argv0 << "\"\n"; + } msg << " Attempted paths:\n"; kwsys_stl::vector<kwsys_stl::string>::iterator i; for(i=failures.begin(); i != failures.end(); ++i) |