From 50a882cf4c56260e391c1d8055f8c4b351c8666a Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Thu, 4 Nov 2004 21:54:46 +0000 Subject: [PATCH] message_begin now reports an error instead of letting th server abort when the id is invalid --- amxmodx/amxmodx.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 546e15f4..e5e4514b 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -1205,6 +1205,14 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */ int numparam = *params/sizeof(cell); float vecOrigin[3]; cell *cpOrigin; + + if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages + && !GET_USER_MSG_NAME(PLID, params[2], NULL))) + { + AMXXLOG_Log("[AMXX] Plugin called message_begin with an invalid message id (%d).", params[2]); + amx_RaiseError(amx, AMX_ERR_NATIVE); + return 0; + } switch (params[1]){ case MSG_BROADCAST: case MSG_ALL: