diff --git a/game_launch/game.cpp b/game_launch/game.cpp index d8bc8152..ca4c4de4 100644 --- a/game_launch/game.cpp +++ b/game_launch/game.cpp @@ -153,7 +153,7 @@ int __stdcall WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int int ret, i; lpArgv = CommandLineToArgvW( GetCommandLineW(), &szArgc ); - szArgv = ( char** )malloc( szArgc * sizeof( char* )); + szArgv = ( char** )malloc( (szArgc + 1) * sizeof( char* )); for( i = 0; i < szArgc; ++i ) { @@ -161,6 +161,7 @@ int __stdcall WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int szArgv[i] = ( char* )malloc( size ); wcstombs( szArgv[i], lpArgv[i], size ); } + szArgv[szArgc] = 0; LocalFree( lpArgv );