diff options
author | Berk Geveci <berk.geveci@kitware.com> | 2001-08-29 13:44:27 (GMT) |
---|---|---|
committer | Berk Geveci <berk.geveci@kitware.com> | 2001-08-29 13:44:27 (GMT) |
commit | efa44fc1f51574331703d15d8e079d6887d932f5 (patch) | |
tree | d51e6b24f2b7c54327206f857010258c658dc7fd /Source/cmSystemTools.cxx | |
parent | 582fe4b51fdc9679cfa139793a696bd3318e6497 (diff) | |
download | CMake-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.cxx | 7 |
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()); } |