Stock BUG!

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 09/10/97

Here's a subtle bug for people.

Upon booting in mini-mud mode on Solaris, I suspected a memory overrun and
traced it to the assign_kings_castle() function of castle.c.  In the
function, there are assignments such as:

  C_MOB_SPEC(Z_KINGS_C, 0) = CastleGuard;   /* Gwydion */

This looks innocent enough until you look at the definition of C_MOB_SPEC:

#define C_MOB_SPEC(zone,mob) (mob_index[real_mobile(((zone)*100)+(mob))].func)

Notice there is *no error checking* if the mob doesn't exist.  So you you
do not have this mob, as is the case for mini-mud mode, you will be
assigning a special procedure to mob_index[-1].func for every one that is

My temporary workaround for this problem was to change the definition to:

#define C_MOB_SPEC(zone,mob)    \
        if ((check = real_mobile(((zone)*100)+(mob))) < 0) {\
          log("Ack! A -1");     \
        } else \

and to add an 'int check;' to the top of assign_kings_castle();

This is the output in mini-mud mode:

Wed Sep 10 12:47:57 :: Assigning function pointers:
Wed Sep 10 12:47:57 ::    Mobiles.
Wed Sep 10 12:47:57 :: Ack! A -1
Wed Sep 10 12:47:57 :: Ack! A -1
Wed Sep 10 12:47:57 :: Ack! A -1

I am not totally sure if this is what was causing OasisOLC to crash...I'll
investigate some more.

(Note that this bug will not affect normal (non -m) MUD mode.)

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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