All natives that use a recipient filter now actually validate the clients passed to them.
This includes StartMessage(), StartMessageEx() from Core as well as EmitSound(), EmitSentence(), and TE_Send() from SDKTools (Warning: This may potentially cause a minor compatibility problem with plugins that don't check client validity before passing to these natives) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402252
This commit is contained in:
@@ -445,10 +445,29 @@ static cell_t smn_TESend(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
cell_t *cl_array;
|
||||
unsigned int numClients;
|
||||
int client;
|
||||
IGamePlayer *pPlayer = NULL;
|
||||
|
||||
pContext->LocalToPhysAddr(params[1], &cl_array);
|
||||
numClients = params[2];
|
||||
|
||||
/* Client validation */
|
||||
for (unsigned int i = 0; i < numClients; i++)
|
||||
{
|
||||
client = cl_array[i];
|
||||
pPlayer = playerhelpers->GetGamePlayer(client);
|
||||
|
||||
if (!pPlayer)
|
||||
{
|
||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||
} else if (!pPlayer->IsInGame()) {
|
||||
return pContext->ThrowNativeError("Client %d is not connected", client);
|
||||
}
|
||||
}
|
||||
|
||||
g_TERecFilter.Reset();
|
||||
g_TERecFilter.Initialize(cl_array, params[2]);
|
||||
g_TERecFilter.Initialize(cl_array, numClients);
|
||||
|
||||
g_CurrentTE->Send(g_TERecFilter, sp_ctof(params[3]));
|
||||
g_CurrentTE = NULL;
|
||||
|
||||
Reference in New Issue
Block a user