Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: SIGSEGV (=a bug)



I got this:

Program received signal SIGSEGV, Segmentation fault.
0x4011543c in strcpy ()
(gdb) bt
#0  0x4011543c in strcpy ()
#1  0x16 in ?? ()
#2  0x80bc38c in write_ch (pl=0x82a2ae0, key=127 '\177') at xio.c:2089
#3  0x8069c25 in parse_writing (op=0x82a2ae0, k=127 '\177') at
commands.c:696
#4  0x8069f6e in parse_key (op=0x82a2ae0, k=127 '\177', kc=22 '\026',
    keysym=65535) at commands.c:754
#5  0x8088f57 in handle_keypress (op=0x82a2ae0, keycode=22, keysym=65535,
    key=127 '\177') at player.c:1909
#6  0x8089a80 in handle_player (op=0x82a2ae0) at player.c:2157
#7  0x8078ea1 in process_players1 (map=0x0) at main.c:552
#8  0x8079248 in process_events (map=0x0) at main.c:626
#9  0x8079ba4 in main (argc=2, argv=0xbffff710) at main.c:892
#10 0x804a91b in _start ()

Is this fix correct? This *looks* like an off-by-one problem to me..

--- server/xio.c.old    Mon Sep  8 15:11:29 1997
+++ server/xio.c        Mon Sep  8 15:11:40 1997
@@ -2043,7 +2043,7 @@
     /* Start of the line - we need to do some extra stuff here. */
     if (pl->contr->infox<3) {
        int line=pl->contr->infopos-1;
-       if (line<0) line=pl->contr->infolines;
+       if (line<0) line=pl->contr->infolines-1;
        strcpy(pl->contr->info[pl->contr->infopos], pl->contr->info[line]);
        pl->contr->infox = pl->contr->infochars-2;
        pl->contr->info[pl->contr->infopos][--pl->contr->infox]=0;

Crossfire version 0.93.5.
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]