Skip to content

Commit

Permalink
Call ProbeForWrite(ReturnLength) to fix a bug
Browse files Browse the repository at this point in the history
Closes #70
  • Loading branch information
mrexodia committed Aug 19, 2022
1 parent fb7085e commit 6a5a68a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions TitanHide/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ static KMUTEX gDebugPortMutex;
#define BACKUP_RETURNLENGTH() \
ULONG TempReturnLength = 0; \
if(ARGUMENT_PRESENT(ReturnLength)) \
TempReturnLength = *ReturnLength
{ \
ProbeForWrite(ReturnLength, sizeof(ULONG), 1); \
TempReturnLength = *ReturnLength; \
}

#define RESTORE_RETURNLENGTH() \
if(ARGUMENT_PRESENT(ReturnLength)) \
Expand Down Expand Up @@ -477,8 +480,12 @@ static NTSTATUS NTAPI HookNtQueryInformationProcess(

__try
{
if (ReturnLength != nullptr)
ProbeForWrite(ReturnLength, sizeof(ULONG), 1);

*(PHANDLE)ProcessInformation = nullptr;
if(ReturnLength != nullptr)

if (ReturnLength != nullptr)
*ReturnLength = sizeof(HANDLE);
}
__except(EXCEPTION_EXECUTE_HANDLER)
Expand Down

0 comments on commit 6a5a68a

Please sign in to comment.