[NEWBIE] crash bug in my mud

From: John Hines (sculpy@MUD3.GATOR.NET)
Date: 09/23/98

I have been having problems with my mud crashing in fights or in the
process of fights whenever more than 1 player is logged into the mud

I have used gdb to search a core that got dumped into my lib.
the following is the result:

#0  replace_string (str=0x0, weapon_singular=0x80b11f4 "blast",
    weapon_plural=0x80b11ed "blasts") at fight.c:447
447       for (; *str; str++) {
(gdb) backtrace
#0  replace_string (str=0x0, weapon_singular=0x80b11f4 "blast",
    weapon_plural=0x80b11ed "blasts") at fight.c:447
#1  0x8070508 in dam_message (dam=100, ch=0x82be2c0, victim=0x81cace0,
    w_type=12) at fight.c:548
#2  0x8070dc3 in damage (ch=0x82be2c0, victim=0x81cace0, dam=367,
    attacktype=312) at fight.c:718
#3  0x80713d5 in hit (ch=0x82be2c0, victim=0x81cace0, type=-1) at
#4  0x8071497 in perform_violence () at fight.c:933
#5  0x804a3de in heartbeat (pulse=77480) at comm.c:828
#6  0x804a319 in game_loop (mother_desc=3) at comm.c:789
#7  0x80498bb in init_game (port=9193) at comm..c:344
#8  0x8049839 in main (argc=3, argv=0xbffffd2c) at comm.c:308
#9  0x804952e in ___crt_dummy__ ()

I have included the area around line 447 in my fight.c file.
It is as follows:

char *replace_string(const char *str, const char *weapon_singular,
                       const char *char *weapon_plural)
               /* Line above made into 2 lines cause my editor sucks *
               *  for this mail. In the code it is one line.         */
  static char buf[256];
  char *cp = buf;

(447 is the following line:)
  for (; *str; str++) {
    if (*str == '#') {
      switch (*(++str)) {
      case 'W':
        for (; *weapon_plural; *(cp++) = *(weapon_plural++));
      case 'w':
        for (; *weapon_singular; *(cp++) = *(weapon_singular++));
        *(cp++) = '#';
  } else
      *(cp++) = *str;

    *cp = 0;
  }                             /* For */

  return (buf);

I am unsure of why i get this error. The above snip is unchanged from
stock as far as I know. I am using pl14 with the OLC+2.1a package from
Del's webpage.

Any help would be great.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |

This archive was generated by hypermail 2b30 : 12/15/00 PST