From: terencehill Date: Mon, 18 Sep 2017 11:52:25 +0000 (+0200) Subject: Fix vote length check (argv_start_index(startpos) returns index in the original vote... X-Git-Tag: xonotic-v0.8.5~2469 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5dc3535a65e2d898bab00363458415cdeb4facd3;p=xonotic%2Fxonotic-data.pk3dir.git Fix vote length check (argv_start_index(startpos) returns index in the original vote command string that included 2 more tokens (vote and call)) --- diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 803de6619..fdcccee3d 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -649,20 +649,10 @@ float VoteCommand_checkargs(float startpos, float argc) int VoteCommand_parse(entity caller, string vote_command, string vote_list, float startpos, float argc) { - string first_command; + string first_command = argv(startpos); - first_command = argv(startpos); - - /*printf("VoteCommand_parse(): Command: '%s', Length: %f.\n", - substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos)), - strlen(substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos))) - );*/ - - if ( - (autocvar_sv_vote_limit > 0) - && - (strlen(substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos))) > autocvar_sv_vote_limit) - ) return 0; + if (autocvar_sv_vote_limit > 0 && strlen(vote_command) > autocvar_sv_vote_limit) + return 0; if (!VoteCommand_checkinlist(first_command, vote_list)) return 0;