View Issue Details

IDProjectCategoryView StatusLast Update
0005052Multi Theft Auto : San AndreasGeneralpublic2009-10-24 21:30
ReporteraruAssigned Toccw 
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformwin32OSOS Version
Product Version1.0.1 
Target Version1.0.2Fixed in Version1.0.2 
Summary0005052: Unable to run Launcher with a very long PATH env
Description

If the PATH environment variable is set to something that's longer than 1024, the loader will fail with the following message: "Load failed. Unable to get the current Path environment variable."

Steps To Reproduce
  1. Set your PATH environment variable to something that's excessively long (longer than 1024 characters)
  2. Run MTASA client
Additional Information

Offending code in MTA10\loader\Main.cpp:

char szOrigPath [ 1024 ];
DWORD dwGetPathResult = GetEnvironmentVariable ( "Path", szOrigPath, sizeof(szOrigPath) );
if ( dwGetPathResult == 0 || dwGetPathResult >= sizeof(szOrigPath) )
{ ... }

Possible fixes:

  1. Setting the szOrigPath size to something larger...
  2. GetEnvironmentVariable returns the number of characters for the env. So doing something like this should work:

    DWORD length = GetEnvironmentVariable( "Path", NULL, 0 );
    char szOrigPath = static_cast<char >( _alloca( length ) );
    DWORD dwGetPathResult = GetEnvironmentVariable ( "Path", szOrigPath, length );
    etc...

TagsNo tags attached.

Issue History

Date Modified Username Field Change