Fixed ServerCommandEx native appending to buffer instead of overwriting (bug 5047, r=fyren).

This commit is contained in:
Asher Baker 2011-10-17 11:02:42 -04:00
parent a875c61b5f
commit ca94a61acf

View File

@ -994,6 +994,11 @@ static cell_t sm_ServerCommandEx(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[1], &g_ServerCommandBuffer);
g_ServerCommandBufferLength = params[2];
if (g_ServerCommandBufferLength > 0)
{
g_ServerCommandBuffer[0] = '\0';
}
engine->ServerExecute();
@ -1004,7 +1009,10 @@ static cell_t sm_ServerCommandEx(IPluginContext *pContext, const cell_t *params)
engine->ServerExecute();
g_ServerCommandBuffer[g_ServerCommandBufferLength-1] = '\0';
if (g_ServerCommandBufferLength > 0)
{
g_ServerCommandBuffer[g_ServerCommandBufferLength-1] = '\0';
}
g_ServerCommandBuffer = NULL;
g_ServerCommandBufferLength = 0;