Re: Dup Bug Revisited

From: Chris Jacobson (fear@ATHENET.NET)
Date: 01/23/98


On 1/22/98 10:09 PM, George (greerga@CIRCLEMUD.ORG) stated:

>(perhaps I should add a dt->character check...but at that point, you
>*should* have one.)

Actually, George, you do need one :-)

The case is from the following code, in Valid_Name:

        /*
         * Make sure someone isn't trying to create this same name.  We want to
         * do a 'str_cmp' so people can't do 'Bob' and 'BoB'.  This check is done
         * here because this will prevent multiple creations of the same name.
         * Note that the creating login will not have a character name yet. -gg
         */
        for (dt = descriptor_list; dt; dt = dt->next)
                if (GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character),
newname))
                        return (STATE(dt) == CON_PLAYING);

Note: it runs through all the descriptors int he list, expecting a valid
dt->character.

The correct code:

        for (dt = descriptor_list; dt; dt = dt->next)
                if (dt->character && GET_NAME(dt->character) &&
!str_cmp(GET_NAME(dt->character), newname))
                        return (STATE(dt) == CON_PLAYING);


The crashes occur when someone creates a new character, and someone else
is also at login with no name entered, or is at a pre-login state (color
patch).

- Chris Jacobson


     +------------------------------------------------------------+
     | 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