Explorar o código

Fix seg fault for empty ENV{} call bug #9747

Bill Hoffman %!s(int64=16) %!d(string=hai) anos
pai
achega
2f94a2c919
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      Source/cmCommandArgumentParserHelper.cxx

+ 5 - 1
Source/cmCommandArgumentParserHelper.cxx

@@ -65,7 +65,11 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
   if ( !key )
     {
     return this->ExpandVariable(var);
-    } 
+    }
+  if(!var)
+    {
+    return this->EmptyVariable;
+    }
   if ( strcmp(key, "ENV") == 0 )
     {
     char *ptr = getenv(var);