Selaa lähdekoodia

KWSys: Avoid empty string dereference in SplitString

Brad King 15 vuotta sitten
vanhempi
sitoutus
4746365e03
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      Source/kwsys/SystemTools.cxx

+ 4 - 0
Source/kwsys/SystemTools.cxx

@@ -1405,6 +1405,10 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
 {
 {
   kwsys_stl::string path = p;
   kwsys_stl::string path = p;
   kwsys_stl::vector<kwsys::String> paths;
   kwsys_stl::vector<kwsys::String> paths;
+  if(path.empty())
+    {
+    return paths;
+    }
   if(isPath && path[0] == '/')
   if(isPath && path[0] == '/')
     {
     {
     path.erase(path.begin());
     path.erase(path.begin());