Skip to content

Commit d43d1c0

Browse files
committed
prevent stack overflow from amx_GetData and correct address obtaining (fixes #59)
1 parent 59e9403 commit d43d1c0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/src/hooks.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ namespace Hooks
222222
{
223223
int ret = base_func(amx, amx_addr, phys_addr);
224224

225+
if(amx_addr == 0)
226+
{
227+
// coming from amx_GetData
228+
return ret;
229+
}
230+
225231
if(ret == AMX_ERR_MEMACCESS)
226232
{
227233
if(strings::pool.is_null_address(amx, amx_addr))
@@ -248,7 +254,8 @@ namespace Hooks
248254
// so checking the actual cell value is necessary,
249255
// but there is a chance that it will interpret
250256
// a number as a string. Better have it disabled by default.
251-
if(strings::pool.is_null_address(amx, **phys_addr))
257+
amx_addr = **phys_addr;
258+
if(strings::pool.is_null_address(amx, amx_addr))
252259
{
253260
strings::null_value2[0] = 1;
254261
strings::null_value2[1] = 0;

0 commit comments

Comments
 (0)