Engine: Add error path to DispatchKeyValue() based on g_inKeyValue
This was unsafe as g_pkvd is pointed to a stack variable that is only valid while inside of pfn_keyvalue()
This commit is contained in:
parent
702f784e44
commit
c24fbda302
|
@ -174,7 +174,13 @@ static cell AMX_NATIVE_CALL DispatchKeyValue(AMX *amx, cell *params)
|
||||||
kvd.fHandled = 0;
|
kvd.fHandled = 0;
|
||||||
|
|
||||||
MDLL_KeyValue(pEntity, &kvd);
|
MDLL_KeyValue(pEntity, &kvd);
|
||||||
} else {
|
} else if (count == 2) {
|
||||||
|
if (!g_inKeyValue)
|
||||||
|
{
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "DispatchKeyValue() with two arguments can only be used inside of pfn_keyvalue()");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int iLength;
|
int iLength;
|
||||||
char *char1 = MF_GetAmxString(amx, params[1], 0, &iLength);
|
char *char1 = MF_GetAmxString(amx, params[1], 0, &iLength);
|
||||||
char *char2 = MF_GetAmxString(amx, params[2], 1, &iLength);
|
char *char2 = MF_GetAmxString(amx, params[2], 1, &iLength);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user