Sanitize load_amxscript() and add load_amxscript_ex/MF_LoadAmxScriptEx() requiring error max length (#530)

* Add a saner version of load_amxscript and use SafeStrcpy/Sprintf

* Reflect the change in core

* Add LoadAmxScriptEx API function

* Reflect the change in CSX

* Reflect the change in DodX

* Reflect the change in TFCX

* Reflect the change in TSX

* Add few comments
This commit is contained in:
Vincent Herbet
2018-08-30 18:49:42 +02:00
committed by GitHub
parent 76378fd5d0
commit 6e9947b64f
18 changed files with 66 additions and 47 deletions

View File

@@ -2399,6 +2399,7 @@ PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot;
PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
PFN_LOAD_AMXSCRIPT_EX g_fn_LoadAmxScriptEx;
PFN_UNLOAD_AMXSCRIPT g_fn_UnloadAmxScript;
PFN_REAL_TO_CELL g_fn_RealToCell;
PFN_CELL_TO_REAL g_fn_CellToReal;
@@ -2491,7 +2492,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
REQFUNC("FindAmxScriptByAmx", g_fn_FindAmxScriptByAmx, PFN_FIND_AMXSCRIPT_BYAMX);
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT); // Deprecated. Please use LoadAmxScriptEx instead.
REQFUNC("LoadAmxScriptEx", g_fn_LoadAmxScriptEx, PFN_LOAD_AMXSCRIPT_EX);
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
@@ -2695,6 +2697,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0);
MF_LoadAmxScript(0, 0, 0, 0, 0);
MF_LoadAmxScriptEx(0, 0, 0, 0, 0, 0);
MF_UnloadAmxScript(0, 0);
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);