aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramdmi3 <amdmi3@FreeBSD.org>2010-06-24 00:38:57 +0800
committeramdmi3 <amdmi3@FreeBSD.org>2010-06-24 00:38:57 +0800
commit06a77678e0fe47f33d665a2fcb37469cbb1eff56 (patch)
treee4a27bed8f8efd3f780333a5505aa6bb847e20e2
parent39bbe552d790c4eb74338df3426f75191974f7e4 (diff)
downloadfreebsd-ports-gnome-06a77678e0fe47f33d665a2fcb37469cbb1eff56.tar.gz
freebsd-ports-gnome-06a77678e0fe47f33d665a2fcb37469cbb1eff56.tar.zst
freebsd-ports-gnome-06a77678e0fe47f33d665a2fcb37469cbb1eff56.zip
- Fix possible server segfaults
PR: 148081 Submitted by: David DEMELIER <demelier.david@gmail.com> Feature safe: yes
-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;