Closed hfiref0x closed 5 years ago
There is an incorrect check of function return value in EnumProcess function
https://github.com/silverf0x/RpcView/blob/c108da277be48accb3c6aaeb4af752a2028069bf/RpcCommon/Misc.c#L52
and then
https://github.com/silverf0x/RpcView/blob/c108da277be48accb3c6aaeb4af752a2028069bf/RpcCommon/Misc.c#L53
and in the end of function
https://github.com/silverf0x/RpcView/blob/c108da277be48accb3c6aaeb4af752a2028069bf/RpcCommon/Misc.c#L64
When CreateToolhelp32Snapshot fails it return INVALID_HANDLE_VALUE (https://docs.microsoft.com/en-us/windows/desktop/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot#return-value) which is not NULL. Thus failed call to CreateToolhelp32Snapshot will lead to invalid handle passed to CloseHandle.
CreateToolhelp32Snapshot return value must be checked against INVALID_HANDLE_VALUE.
There is an incorrect check of function return value in EnumProcess function
https://github.com/silverf0x/RpcView/blob/c108da277be48accb3c6aaeb4af752a2028069bf/RpcCommon/Misc.c#L52
and then
https://github.com/silverf0x/RpcView/blob/c108da277be48accb3c6aaeb4af752a2028069bf/RpcCommon/Misc.c#L53
and in the end of function
https://github.com/silverf0x/RpcView/blob/c108da277be48accb3c6aaeb4af752a2028069bf/RpcCommon/Misc.c#L64
When CreateToolhelp32Snapshot fails it return INVALID_HANDLE_VALUE (https://docs.microsoft.com/en-us/windows/desktop/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot#return-value) which is not NULL. Thus failed call to CreateToolhelp32Snapshot will lead to invalid handle passed to CloseHandle.
CreateToolhelp32Snapshot return value must be checked against INVALID_HANDLE_VALUE.