jeudi 30 septembre 2021

How to check a dangling pointer before writing to it [duplicate]

while program is executing in the runtime the game at sometime deallocates the address pointed by the pointer and it becomes a dangling one, The program inturn writes to this deallocated place of memory resulting in a crash! So is there anyway to make a condition to check if the address pointed by this pointer is always existing in memory before the program writes to it? im still newbie to pointers but as far as i know the dangling ptr doesn't equal a null.

DWORD moduleBase = (DWORD)GetModuleHandle("game.exe");
DWORD zoom_addy = *(DWORD*)(moduleBase + 0x657686);

//writing to address
*(int*)(zoom_addy + offset) = //value

Aucun commentaire:

Enregistrer un commentaire