changeset 812:3d09cc6c4ea9

6787009: (attach) Stub injection potentially unsafe on windows-x64 Reviewed-by: mchung
author alanb
date Mon, 22 Dec 2008 19:28:49 +0000
parents 850d381fa9aa
children 37a9442e3203 0bd360988b3a f6c105e60186
files src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Fri Dec 19 22:07:37 2008 -0800
+++ b/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Mon Dec 22 19:28:49 2008 +0000
@@ -345,7 +345,6 @@
     DataBlock data;
     DataBlock* pData;
     DWORD* pCode;
-    DWORD numBytes;
     DWORD stubLen;
     HANDLE hProcess, hThread;
     jint argsLen, i;
@@ -400,7 +399,7 @@
         JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
         return;
     }
-    WriteProcessMemory( hProcess, (LPVOID)pData, (LPVOID)&data, (DWORD)sizeof(DataBlock), &numBytes );
+    WriteProcessMemory( hProcess, (LPVOID)pData, (LPCVOID)&data, (SIZE_T)sizeof(DataBlock), NULL );
 
 
     stubLen = (DWORD)(*env)->GetArrayLength(env, stub);
@@ -412,7 +411,7 @@
         VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
         return;
     }
-    WriteProcessMemory( hProcess, (LPVOID)pCode, (LPVOID)stubCode, (DWORD)stubLen, &numBytes );
+    WriteProcessMemory( hProcess, (LPVOID)pCode, (LPCVOID)stubCode, (SIZE_T)stubLen, NULL );
     if (isCopy) {
         (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
     }