diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 33d3e64c6..61cca36ce 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2293,7 +2293,8 @@ bool SystemTools::FileIsDirectory(const char* name) // Remove any trailing slash from the name. char buffer[KWSYS_SYSTEMTOOLS_MAXPATH]; int last = static_cast(strlen(name))-1; - if(last >= 0 && (name[last] == '/' || name[last] == '\\')) + if(last > 0 && (name[last] == '/' || name[last] == '\\') + && strcmp(name, "/") !=0) { memcpy(buffer, name, last); buffer[last] = 0;