Fix potential crashes from bad pointers (typically after ads)

This commit is contained in:
_ 2020-12-03 16:57:32 -07:00
parent 70f6695b72
commit 44a7190b7a

View File

@ -200,6 +200,10 @@ int* __fastcall log_hook_v45(void* This, void* _EDX, int a2, int a3, void* a4, c
void __fastcall fileIdWriter_hook_v45(void* This, void* _EDX, int* a2)
{
// Program sometimes crashes after ads. Could possibly be due to bad pointers
if (Utils::BadPtr(a2) || Utils::BadPtr(a2 + 16) || Utils::BadPtr((char*)*(DWORD*)(a2 + 16)))
return;
// [[ebp+8]+28]
char* fileId = (char*) *(DWORD*)(a2 + 16); // 0x40 / 4 = 16
::fileId = std::string(fileId);