Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#8413) Server segfaults in stdinhand.c
Home

[Freeciv-Dev] (PR#8413) Server segfaults in stdinhand.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8413) Server segfaults in stdinhand.c
From: "andrearo@xxxxxxxxxxxx" <andrearo@xxxxxxxxxxxx>
Date: Sun, 28 Mar 2004 11:35:36 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8413 >


I get a segfault in the server when executing a command from a client that
is not bound to a player. Here's the output from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0805560c in handle_stdin_input (caller=0x81731d4, str=0x8a6adcf " Segfault",
    check=false) at stdinhand.c:4127
4127        int idx = caller->player->player_no;


To reproduce, connect a client to a server using authentication,
and start a game. Then connect another client to the server, and issue
_any_ command, and it results in a segfault.

I've attached a suggestion for a fix, which uses the connection id instead of 
player id.

Andreas Røsdal


diff -ruN -Xfreeciv/diff_ignore freeciv/server/stdinhand.c 
freeciv-auth/server/stdinhand.c
--- freeciv/server/stdinhand.c  2004-03-26 17:45:13.000000000 +0100
+++ freeciv-auth/server/stdinhand.c     2004-03-28 21:17:08.815827928 +0200
@@ -4124,7 +4124,7 @@
       && !check
       && caller->access_level == ALLOW_INFO
       && commands[cmd].level == ALLOW_CTRL) {
-    int idx = caller->player->player_no;
+    int idx = caller->id;
 
     /* If we already have a vote going, cancel it in favour of the new
      * vote command. You can only have one vote at a time. */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8413) Server segfaults in stdinhand.c, andrearo@xxxxxxxxxxxx <=