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

CF: Patch to a bug



This is a patch to the bug I found:

*** server/hiscore.c.old        Wed Sep 10 12:03:53 1997
--- server/hiscore.c    Wed Sep 10 12:04:25 1997
***************
*** 236,242 ****
      if(new_score.killer[0]=='\0')
        strcpy(new_score.killer,"a dungeon collapse");
      new_score.exp=op->stats.exp;
!     if(op->map == NULL)
        *new_score.maplevel = '\0';
      else { 
        strncpy(new_score.maplevel,op->map->map_object->name,BIG_NAME-1);
--- 236,242 ----
      if(new_score.killer[0]=='\0')
        strcpy(new_score.killer,"a dungeon collapse");
      new_score.exp=op->stats.exp;
!     if(op->map == NULL || op->map->map_object==NULL)
        *new_score.maplevel = '\0';
      else { 
        strncpy(new_score.maplevel,op->map->map_object->name,BIG_NAME-1);

It should work, though I don't know if it does "the Right Thing"..

This is what I got with GDB:

Program received signal SIGSEGV, Segmentation fault.
0x806b2aa in check_score (op=0x83b8010) at hiscore.c:242
242 strncpy(new_score.maplevel,op->map->map_object->name,BIG_NAME-1);
(gdb) print *op->map
$9 = {next = 0x8308e40, where = 0x0,
  path = "/city/city", '\000' <repeats 245 times>,
  tmpname = 0x877b198 "/tmp/cfire/cftmp.d7842", reset_time = 873815859,
  timeout = 0, need_refresh = 0, lock_items = 0, players = 0, in_memory = 2,
  encounter = 0, compressed = 0 '\000', map = 0x0, floor = 0x0, map_ob = 0x0,
  difficulty = 1, pending = 0x0, do_los = 1, darkness = 0 '\000', light = 0x0,
  map_object = 0x0, buttons = 0x0}
(gdb)

Notice that op->map->map_object == NULL.
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]