Fixed sm_kick where it was not using decl safely.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401222
This commit is contained in:
Phong Dang 2007-07-30 19:10:46 +00:00
parent c027b864fa
commit 9b86e7bdf6

View File

@ -572,8 +572,12 @@ public Action:Command_Kick(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));
decl String:arg[65]; decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg)); new len = BreakString(Arguments, arg, sizeof(arg));
new target = FindTarget(client, arg); new target = FindTarget(client, arg);
if (target == -1) if (target == -1)
@ -581,27 +585,19 @@ public Action:Command_Kick(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:name[65]; GetClientName(target, arg, sizeof(arg));
GetClientName(target, name, sizeof(name));
decl String:reason[256]; if (len == -1)
if (args < 2)
{ {
/* Safely null terminate */ /* Safely null terminate */
reason[0] = '\0'; len = 0;
} else { Arguments[0] = '\0';
GetCmdArgString(reason, sizeof(reason));
new len = BreakString(reason, arg, sizeof(arg));
strcopy(reason, sizeof(reason), reason[len]);
} }
ShowActivity(client, "%t", "Kicked player", name); ShowActivity(client, "%t", "Kicked player", arg);
LogMessage("\"%L\" kicked \"%L\" (reason \"%s\")", client, target, reason); LogMessage("\"%L\" kicked \"%L\" (reason \"%s\")", client, target, Arguments[len]);
KickClient(target, "%s", reason); KickClient(target, "%s", Arguments[len]);
return Plugin_Handled; return Plugin_Handled;
} }