From 59921e728d2374a86ee4657cf2f695d461b187d4 Mon Sep 17 00:00:00 2001 From: Laurent Pellegrino Date: Wed, 20 May 2015 09:51:57 +0200 Subject: [PATCH] Fix for getCmdLineAndEnvVars which fails on x64 versions of Windows --- native/envvar-cmdline.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/native/envvar-cmdline.cpp b/native/envvar-cmdline.cpp index 57f9bc6..fd01ff2 100644 --- a/native/envvar-cmdline.cpp +++ b/native/envvar-cmdline.cpp @@ -184,7 +184,8 @@ JNIEXPORT jstring JNICALL Java_org_jvnet_winp_Native_getCmdLineAndEnvVars( } int cmdLineLen = lstrlen(pszCmdLine); - size_t envSize = info.RegionSize; + size_t envSize = info.RegionSize - ((char*)pEnvStr - (char*)info.BaseAddress); + auto_localmem buf((cmdLineLen + 1/*for \0*/) * 2 + envSize); if(!buf) { reportError(pEnv, "Buffer allocation failed");