Fix #30: potential null pointer dereference in GetRpcServerAddressInProcess and wWinMain

This commit is contained in:
silverf0x 2019-01-15 21:31:40 +01:00
parent 419a8e0856
commit 91bf7750e6
2 changed files with 5 additions and 2 deletions

View File

@ -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++)

View File

@ -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;