summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-21 00:29:12 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-21 00:29:12 (GMT)
commitce2b20361a152008994e5083b6d310e98b40e0e1 (patch)
treeea36c032cef7dca3feeef0d5df2389c6eb72b347 /Source/kwsys/SystemTools.cxx
parent9f982d7d39a92fa1164a6e3f653dbce17ca38ad7 (diff)
downloadCMake-ce2b20361a152008994e5083b6d310e98b40e0e1.zip
CMake-ce2b20361a152008994e5083b6d310e98b40e0e1.tar.gz
CMake-ce2b20361a152008994e5083b6d310e98b40e0e1.tar.bz2
BUG: Fix previous commit to not access empty strings out of bounds.
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index de00019..d209682 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2117,7 +2117,7 @@ kwsys_stl::string SystemTools
i != path.end(); ++i)
{
kwsys_stl::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}
@@ -2249,7 +2249,7 @@ kwsys_stl::string SystemTools::FindProgram(
i != path.end(); ++i)
{
kwsys_stl::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}
@@ -2341,7 +2341,7 @@ kwsys_stl::string SystemTools
i != path.end(); ++i)
{
kwsys_stl::string& p = *i;
- if(p[p.size()-1] != '/')
+ if(p.empty() || p[p.size()-1] != '/')
{
p += "/";
}