From 9e3e86249d0dd6699eb4b15502cc40db3b498742 Mon Sep 17 00:00:00 2001 From: stpohle Date: Fri, 4 Apr 2008 10:40:30 +0000 Subject: [PATCH] fixed bug found by Lars Poeschel, contest.to = -1 hasend been checked right in do_contest --- src/packets.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/packets.c b/src/packets.c index 52a3452..4d38f90 100644 --- a/src/packets.c +++ b/src/packets.c @@ -245,11 +245,15 @@ do_contest (struct pkg_contest *ct_pkg, _net_addr * addr) /* master will have to change the firewall flag on a player */ if (GT_MP_PTPM) { - if (ct_pkg->from < 0 || ct_pkg->from >= MAX_PLAYERS) { - if ((ct_pkg->to < 0 || ct_pkg->to >= MAX_PLAYERS) && addr->pl_nr != ct_pkg->from) - d_printf (" from or to value out of range (0-MAX_PLAYERS)\n"); - return; - } + if ((ct_pkg->from < 0 || ct_pkg->from >= MAX_PLAYERS + || ct_pkg->to < -1 || ct_pkg->to >= MAX_PLAYERS + || addr->pl_nr != ct_pkg->from) { + d_printf (" from or to value out of range (0-MAX_PLAYERS)\n"); + return; + } + /* ignore packet it's just a workaround for + * some hardware router */ + if ((ct_pkg->to == -1) return; players[ct_pkg->to].net.flags &= (0xFF - NETF_firewall); net_game_send_player (ct_pkg->to); @@ -371,6 +375,8 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr) else pl->state = p_id->state & (0xFF - PSF_alife); + /* set the NETWORK flag for the network player. + * this had to be done after the contest part. */ if (p_id->pl_nr != bman.p_nr && PS_IS_used (pl->state)) pl->state |= PSF_net; else