[Cmake-commits] [cmake-commits] king committed SystemTools.cxx 1.237 1.238

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Apr 20 08:42:09 EDT 2009


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv3398/Source/kwsys

Modified Files:
	SystemTools.cxx 
Log Message:
BUG: Fix SystemTools::IsSubDirectory on bad input

When SystemTools::GetParentDirectory was fixed to never remove the root
path component from a full path we violated an assumption made by
IsSubDirectory that eventually GetParentDirectory returns an empty
string.  This led to an infinite loop if the potential parent directory
is empty, so we explicitly avoid that case.


Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.237
retrieving revision 1.238
diff -C 2 -d -r1.237 -r1.238
*** SystemTools.cxx	15 Apr 2009 17:03:33 -0000	1.237
--- SystemTools.cxx	20 Apr 2009 12:42:05 -0000	1.238
***************
*** 3981,3984 ****
--- 3981,3988 ----
  bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir)
  {
+   if(!*cDir)
+     {
+     return false;
+     }
    kwsys_stl::string subdir = cSubdir;
    kwsys_stl::string dir = cDir;



More information about the Cmake-commits mailing list