6787009: (attach) Stub injection potentially unsafe on windows-x64
authoralanb
Mon, 22 Dec 2008 19:28:49 +0000
changeset 1765 ee78704ab554
parent 1764 d996eced9706
child 1766 4ad5c0f4cf79
child 1767 d30e181922eb
child 1770 3b41559daa17
6787009: (attach) Stub injection potentially unsafe on windows-x64 Reviewed-by: mchung
jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Fri Dec 19 22:07:37 2008 -0800
+++ b/jdk/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);
     }