<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39392 >

When a user connect a server where nplayers = maxplayer, he is attached to a 
new player.
I guess if nplayer = MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS, it will crash. 
Please correct the bug for 2.0, 2.1 and trunk branches:

--- freeciv-2.0.9/server/connecthand.c  2007-02-10 03:06:30.000000000 +0100
+++ test/server/connecthand.c   2007-06-12 13:02:45.000000000 +0200
@@ -409,8 +409,8 @@
{
   /* if pplayer is NULL, attach to first non-connected player slot */
   if (!pplayer) {
-    if (game.nplayers > game.max_players
-        || game.nplayers > MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS) {
+    if (game.nplayers >= game.max_players
+        || game.nplayers >= MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS) {
       return FALSE;
     } else {
       pplayer = &game.players[game.nplayers];

Thanks you.

_________________________________________________________________
Découvrez le Blog heroic Fantaisy d'Eragon! 
http://eragon-heroic-fantasy.spaces.live.com/

--- freeciv-2.0.9/server/connecthand.c	2007-02-10 03:06:30.000000000 +0100
+++ test/server/connecthand.c	2007-06-12 13:02:45.000000000 +0200
@@ -409,8 +409,8 @@
 {
   /* if pplayer is NULL, attach to first non-connected player slot */
   if (!pplayer) {
-    if (game.nplayers > game.max_players 
-        || game.nplayers > MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS) {
+    if (game.nplayers >= game.max_players 
+        || game.nplayers >= MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS) {
       return FALSE; 
     } else {
       pplayer = &game.players[game.nplayers];

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to