Debian Codegraph @

debian/patches/Fix-for-crashing-the-server-by-making-a-callvote-to-.patch

raw
1 From: Poul Sander <[email protected]>
2 Date: Thu, 6 Sep 2012 20:34:53 +0000
3 Subject: Fix for crashing the server by making a callvote to kick a player
4 which does not exist
5
6 A fix for Debian Bug #681812. Doing "callvote kick PLAYERNAME" for a
7 playername that did not exist resultet in undefined behavior.
8
9 Depending on architecture this resultet in a crash or something else.
10
11 Origin: upstream
12 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681812
13 Applied-Upstream: https://github.com/OpenArena/gamecode/commit/f0c49c28c448288572d960840aa541a9017e6d01
14 Last-Update: 2012-09-13
15 Tested-by: Markus Koschany <[email protected]>
16 ---
17 code/game/g_cmds.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20 diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c
21 index 3a14e51..55145bf 100644
22 --- a/code/game/g_cmds.c
23 +++ b/code/game/g_cmds.c
24 @@ -1812,7 +1812,7 @@ void Cmd_CallVote_f( gentity_t *ent ) {
25 Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "Shuffle teams?" );
26 } else if ( !Q_stricmp( arg1, "kick" ) ) {
27 i = 0;
28 - while(Q_stricmp(arg2,(g_entities+i)->client->pers.netname)) {
29 + while( !(g_entities+i) || !((g_entities+i)->client) || Q_stricmp(arg2,(g_entities+i)->client->pers.netname)) {
30 //Not client i, try next
31 i++;
32 if(i>=MAX_CLIENTS){ //Only numbers <128 is clients