Fix a buffer issue in EngFunc_LightStyle (#508)
This commit is contained in:
parent
9700caefae
commit
faf7da4c2c
|
@ -12,9 +12,12 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "fakemeta_amxx.h"
|
#include "fakemeta_amxx.h"
|
||||||
|
#include <engine_strucs.h>
|
||||||
|
|
||||||
TraceResult g_tr;
|
TraceResult g_tr;
|
||||||
|
|
||||||
|
ke::AString LightStyleBuffers[MAX_LIGHTSTYLES];
|
||||||
|
|
||||||
//by mahnsawce from his NS module
|
//by mahnsawce from his NS module
|
||||||
static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
@ -595,8 +598,13 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||||
case EngFunc_LightStyle: // void ) (int style, const char* val);
|
case EngFunc_LightStyle: // void ) (int style, const char* val);
|
||||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||||
iparam1=cRet[0];
|
iparam1=cRet[0];
|
||||||
temp = MF_GetAmxString(amx,params[3],0,&len);
|
if (iparam1 < 0 || iparam1 >= ARRAYSIZE(LightStyleBuffers))
|
||||||
(*g_engfuncs.pfnLightStyle)(iparam1,temp);
|
{
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid style %d", iparam1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LightStyleBuffers[iparam1] = MF_GetAmxString(amx, params[3], 0, &len);
|
||||||
|
(*g_engfuncs.pfnLightStyle)(iparam1, LightStyleBuffers[iparam1].chars());
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user