Fixed ServerCommandEx native appending to buffer instead of overwriting (bug 5047, r=fyren).
Fixed ServerCommandEx native appending to buffer instead of overwriting (
bug 5047, r=fyren).
1.1 --- a/core/smn_console.cpp Mon Oct 17 10:55:44 2011 -0400
1.2 +++ b/core/smn_console.cpp Mon Oct 17 11:02:42 2011 -0400
1.3 @@ -994,6 +994,11 @@
1.4
1.5 pContext->LocalToString(params[1], &g_ServerCommandBuffer);
1.6 g_ServerCommandBufferLength = params[2];
1.7 +
1.8 + if (g_ServerCommandBufferLength > 0)
1.9 + {
1.10 + g_ServerCommandBuffer[0] = '\0';
1.11 + }
1.12
1.13 engine->ServerExecute();
1.14
1.15 @@ -1004,7 +1009,10 @@
1.16
1.17 engine->ServerExecute();
1.18
1.19 - g_ServerCommandBuffer[g_ServerCommandBufferLength-1] = '\0';
1.20 + if (g_ServerCommandBufferLength > 0)
1.21 + {
1.22 + g_ServerCommandBuffer[g_ServerCommandBufferLength-1] = '\0';
1.23 + }
1.24
1.25 g_ServerCommandBuffer = NULL;
1.26 g_ServerCommandBufferLength = 0;