ports/148081: games/teeworlds server segfaults

David DEMELIER demelier.david at gmail.com
Wed Jun 23 08:20:03 UTC 2010


>Number:         148081
>Category:       ports
>Synopsis:       games/teeworlds server segfaults
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 23 08:20:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     David DEMELIER
>Release:        8.1-PRERELEASE
>Organization:
>Environment:
FreeBSD Melon.malikania.fr 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #10: Sun Jun 20 16:13:06 CEST 2010     root at Melon.malikania.fr:/usr/obj/usr/src/sys/Melon  amd64

>Description:
Hi,

As you can read here : 

http://www.teeworlds.com/forum/viewtopic.php?pid=68163

There was a problem while running the teeworlds server. Because they advised me to apply this patch :

http://www.teeworlds.com/track/teeworlds/changeset/2009

I made a patch that adds two patches in the games/teeworlds/files directory. Now it shouldn't segfault anymore.


>How-To-Repeat:
cd /usr/ports/games/teeworlds
make config # enable server only
teeworlds_srv 

-> Segmentation fault.
>Fix:
--- /dev/null	2010-06-23 09:45:16.000000000 +0200
+++ files/patch-e_network.c	2010-06-23 09:43:04.000000000 +0200
@@ -0,0 +1,15 @@
+--- src/engine/e_network.c.orig	2010-06-23 09:39:36.000000000 +0200
++++ src/engine/e_network.c	2010-06-23 09:41:29.000000000 +0200
+@@ -224,6 +224,12 @@
+ 
+ 	if(packet->flags&NET_PACKETFLAG_CONNLESS)
+ 	{
++		/* check the size of connless packet */
++		if(size < 6)
++		{
++			dbg_msg("", "connless packet too small, %d", size);
++			return -1;
++		}
+ 		packet->flags = NET_PACKETFLAG_CONNLESS;
+ 		packet->ack = 0;
+ 		packet->num_chunks = 0;
--- /dev/null	2010-06-23 09:45:22.000000000 +0200
+++ files/patch-es_server.c	2010-06-23 09:43:27.000000000 +0200
@@ -0,0 +1,20 @@
+--- src/engine/server/es_server.c.orig	2010-06-23 09:41:50.000000000 +0200
++++ src/engine/server/es_server.c	2010-06-23 09:42:21.000000000 +0200
+@@ -303,7 +303,7 @@
+ 
+ void server_kick(int client_id, const char *reason)
+ {
+-	if(client_id < 0 || client_id > MAX_CLIENTS)
++	if(client_id < 0 || client_id >= MAX_CLIENTS)
+ 		return;
+ 		
+ 	if(clients[client_id].state != SRVCLIENT_STATE_EMPTY)
+@@ -1244,7 +1244,7 @@
+ 		NETADDR addr;
+ 		int cid = atoi(str);
+ 
+-		if(cid < 0 || cid > MAX_CLIENTS || clients[cid].state == SRVCLIENT_STATE_EMPTY)
++		if(cid < 0 || cid >= MAX_CLIENTS || clients[cid].state == SRVCLIENT_STATE_EMPTY)
+ 		{
+ 			dbg_msg("server", "invalid client id");
+ 			return;
--- Makefile.orig	2010-06-23 10:04:01.000000000 +0200
+++ Makefile	2010-06-23 10:04:13.000000000 +0200
@@ -7,6 +7,7 @@
 
 PORTNAME=	teeworlds
 PORTVERSION=	0.5.2
+PORTREVISION=	1
 CATEGORIES=	games
 MASTER_SITES=	http://www.teeworlds.com/files/ \
 		http://mirror.amdmi3.ru/distfiles/


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list