From 270401c658a5cf30f7d8c0a48ff7a2d6b8f170a6 Mon Sep 17 00:00:00 2001 From: hfiref0x Date: Wed, 16 Jan 2019 14:03:21 +0700 Subject: [PATCH 1/2] Update RpcView.cpp Handle OS_ALLOC heap allocation potential failure in InitDecompilerInfo --- RpcView/RpcView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RpcView/RpcView.cpp b/RpcView/RpcView.cpp index 43775d8..e6d997b 100644 --- a/RpcView/RpcView.cpp +++ b/RpcView/RpcView.cpp @@ -189,7 +189,9 @@ void NTAPI InitDecompilerInfo(_In_ RpcInterfaceInfo_T* pRpcInterfaceInfo, _Out_ { SymboleLength = ((UINT)wcslen(SymboleName) + 1)*sizeof(WCHAR); pRpcDecompilerInfo->ppProcNameTable[i] = (WCHAR*)OS_ALLOC(SymboleLength); - memcpy(pRpcDecompilerInfo->ppProcNameTable[i], SymboleName, SymboleLength); + if (pRpcDecompilerInfo->ppProcNameTable[i] != NULL) { + memcpy(pRpcDecompilerInfo->ppProcNameTable[i], SymboleName, SymboleLength); + } } } PdbUninit(hPdb); From 6f8e8f45fcf61063893d7b0b8741d78390443869 Mon Sep 17 00:00:00 2001 From: hfiref0x Date: Wed, 16 Jan 2019 14:05:49 +0700 Subject: [PATCH 2/2] Update RpcView.cpp Set formatting to original RpcView style. --- RpcView/RpcView.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RpcView/RpcView.cpp b/RpcView/RpcView.cpp index e6d997b..a8990ad 100644 --- a/RpcView/RpcView.cpp +++ b/RpcView/RpcView.cpp @@ -189,9 +189,9 @@ void NTAPI InitDecompilerInfo(_In_ RpcInterfaceInfo_T* pRpcInterfaceInfo, _Out_ { SymboleLength = ((UINT)wcslen(SymboleName) + 1)*sizeof(WCHAR); pRpcDecompilerInfo->ppProcNameTable[i] = (WCHAR*)OS_ALLOC(SymboleLength); - if (pRpcDecompilerInfo->ppProcNameTable[i] != NULL) { - memcpy(pRpcDecompilerInfo->ppProcNameTable[i], SymboleName, SymboleLength); - } + if (pRpcDecompilerInfo->ppProcNameTable[i] != NULL) { + memcpy(pRpcDecompilerInfo->ppProcNameTable[i], SymboleName, SymboleLength); + } } } PdbUninit(hPdb);