Browse Source

ENH: fix crash when glob has wrong number of arguments

Bill Hoffman 19 years ago
parent
commit
8033e32203
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Source/cmFileCommand.cxx

+ 5 - 0
Source/cmFileCommand.cxx

@@ -233,6 +233,11 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
         }
         }
       g.SetRelative(i->c_str());
       g.SetRelative(i->c_str());
       ++i;
       ++i;
+      if(i == args.end())
+        {
+        this->SetError("GLOB requires a glob expression after the directory");
+        return false;
+        }
       }
       }
     if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) )
     if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) )
       {
       {