mirror of
https://github.com/silverf0x/RpcView
synced 2026-06-08 17:26:38 +00:00
Fix #30: potential null pointer dereference in GetRpcServerAddressInProcess and wWinMain
This commit is contained in:
@@ -226,6 +226,7 @@ BOOL WINAPI GetRpcServerAddressInProcess(DWORD Pid,RpcCoreInternalCtxt_T* pRpcCo
|
||||
EnumProcessModulesEx(hProcess, NULL, 0, &cbSize, LIST_MODULES_ALL);
|
||||
if (cbSize == 0) goto End;
|
||||
pHmodule = (HMODULE*)malloc(cbSize);
|
||||
if (pHmodule == NULL) goto End;
|
||||
EnumProcessModulesEx(hProcess, pHmodule, cbSize, &cbSize, LIST_MODULES_ALL);
|
||||
|
||||
for(ULONG i=0;i<cbSize/sizeof(*pHmodule);i++)
|
||||
|
||||
+4
-2
@@ -328,12 +328,12 @@ End:
|
||||
HICON hMainIcon;
|
||||
UCHAR CurrentDirectory[MAX_PATH];
|
||||
UCHAR* pSeparator;
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
#ifdef _DEBUG
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
|
||||
#else
|
||||
int argc = 0;
|
||||
int argc = 0;
|
||||
|
||||
UNREFERENCED_PARAMETER(hInstance);
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
@@ -343,6 +343,8 @@ End:
|
||||
LPWSTR* argvw = CommandLineToArgvW(pCmdLine, &argc);
|
||||
|
||||
char** argv = (char**)malloc(argc*sizeof(char*));
|
||||
if (argv == NULL) return ret;
|
||||
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
size_t tmpSize = lstrlenW(argvw[i]) * 2 + 2;
|
||||
|
||||
Reference in New Issue
Block a user