summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBerk Geveci <berk.geveci@kitware.com>2001-08-29 13:44:27 (GMT)
committerBerk Geveci <berk.geveci@kitware.com>2001-08-29 13:44:27 (GMT)
commitefa44fc1f51574331703d15d8e079d6887d932f5 (patch)
treed51e6b24f2b7c54327206f857010258c658dc7fd /Source/cmSystemTools.cxx
parent582fe4b51fdc9679cfa139793a696bd3318e6497 (diff)
downloadCMake-efa44fc1f51574331703d15d8e079d6887d932f5.zip
CMake-efa44fc1f51574331703d15d8e079d6887d932f5.tar.gz
CMake-efa44fc1f51574331703d15d8e079d6887d932f5.tar.bz2
BUG: fix out of bounds read on string in mkdir
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1494a34..4a2948b 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -140,7 +140,10 @@ bool cmSystemTools::MakeDirectory(const char* path)
return true;
}
std::string dir = path;
-
+ if(dir.size() == 0)
+ {
+ return false;
+ }
cmSystemTools::ConvertToUnixSlashes(dir);
std::string::size_type pos = dir.find(':');
@@ -155,7 +158,7 @@ bool cmSystemTools::MakeDirectory(const char* path)
Mkdir(topdir.c_str());
pos++;
}
- if(topdir[dir.size()] == '/')
+ if(dir[dir.size()-1] == '/')
{
topdir = dir.substr(0, dir.size());
}