Package: openarena / 0.8.8+dfsg-2

Fix-for-crashing-the-server-by-making-a-callvote-to-.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Poul Sander <sago007@gmail.com>
Date: Thu, 6 Sep 2012 20:34:53 +0000
Subject: Fix for crashing the server by making a callvote to kick a player
 which does not exist

A fix for Debian Bug #681812. Doing "callvote kick PLAYERNAME" for a
playername that did not exist resultet in undefined behavior.

Depending on architecture this resultet in a crash or something else.

Origin: upstream
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681812
Applied-Upstream: https://github.com/OpenArena/gamecode/commit/f0c49c28c448288572d960840aa541a9017e6d01
Last-Update: 2012-09-13
Tested-by: Markus Koschany <apo@gambaru.de>
---
 code/game/g_cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c
index 3a14e51..55145bf 100644
--- a/code/game/g_cmds.c
+++ b/code/game/g_cmds.c
@@ -1812,7 +1812,7 @@ void Cmd_CallVote_f( gentity_t *ent ) {
 		Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "Shuffle teams?" );
         } else if ( !Q_stricmp( arg1, "kick" ) ) {
                 i = 0;
-                while(Q_stricmp(arg2,(g_entities+i)->client->pers.netname)) {
+ 		while( !(g_entities+i) || !((g_entities+i)->client) || Q_stricmp(arg2,(g_entities+i)->client->pers.netname)) {
                     //Not client i, try next
                     i++;
                     if(i>=MAX_CLIENTS){ //Only numbers <128 is clients