aboutsummaryrefslogtreecommitdiff
path: root/games/teeworlds
diff options
context:
space:
mode:
authorDmitry Marakasov <amdmi3@FreeBSD.org>2010-06-23 16:38:57 +0000
committerDmitry Marakasov <amdmi3@FreeBSD.org>2010-06-23 16:38:57 +0000
commit7bc09b0e8326b465bf041d881678412ecba16753 (patch)
tree292646594a5cf1f0842a1c47f63a1b80e0b26b90 /games/teeworlds
parent8620c445eb9d8d36765c1c667ed923bcc98a4dc3 (diff)
downloadports-7bc09b0e8326b465bf041d881678412ecba16753.tar.gz
ports-7bc09b0e8326b465bf041d881678412ecba16753.zip
- Fix possible server segfaults
PR: 148081 Submitted by: David DEMELIER <demelier.david@gmail.com> Feature safe: yes
Notes
Notes: svn path=/head/; revision=256867
Diffstat (limited to 'games/teeworlds')
-rw-r--r--games/teeworlds/Makefile1
-rw-r--r--games/teeworlds/files/patch-e_network.c15
-rw-r--r--games/teeworlds/files/patch-es_server.c20
3 files changed, 36 insertions, 0 deletions
diff --git a/games/teeworlds/Makefile b/games/teeworlds/Makefile
index ca2d161c5daf..a5b23f22fb32 100644
--- a/games/teeworlds/Makefile
+++ b/games/teeworlds/Makefile
@@ -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/
diff --git a/games/teeworlds/files/patch-e_network.c b/games/teeworlds/files/patch-e_network.c
new file mode 100644
index 000000000000..d1f419d2e6dc
--- /dev/null
+++ b/games/teeworlds/files/patch-e_network.c
@@ -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;
diff --git a/games/teeworlds/files/patch-es_server.c b/games/teeworlds/files/patch-es_server.c
new file mode 100644
index 000000000000..4af057af3cca
--- /dev/null
+++ b/games/teeworlds/files/patch-es_server.c
@@ -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;