BUG: fix out of bounds read on string in mkdir
This commit is contained in:
parent
582fe4b51f
commit
efa44fc1f5
|
@ -140,7 +140,10 @@ bool cmSystemTools::MakeDirectory(const char* path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::string dir = path;
|
std::string dir = path;
|
||||||
|
if(dir.size() == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
cmSystemTools::ConvertToUnixSlashes(dir);
|
cmSystemTools::ConvertToUnixSlashes(dir);
|
||||||
|
|
||||||
std::string::size_type pos = dir.find(':');
|
std::string::size_type pos = dir.find(':');
|
||||||
|
@ -155,7 +158,7 @@ bool cmSystemTools::MakeDirectory(const char* path)
|
||||||
Mkdir(topdir.c_str());
|
Mkdir(topdir.c_str());
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
if(topdir[dir.size()] == '/')
|
if(dir[dir.size()-1] == '/')
|
||||||
{
|
{
|
||||||
topdir = dir.substr(0, dir.size());
|
topdir = dir.substr(0, dir.size());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue