From 5dc3535a65e2d898bab00363458415cdeb4facd3 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 18 Sep 2017 13:52:25 +0200 Subject: [PATCH] Fix vote length check (argv_start_index(startpos) returns index in the original vote command string that included 2 more tokens (vote and call)) --- qcsrc/server/command/vote.qc | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) 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; -- 2.39.2