Re: [NEWBIE] Circle Score Bug

From: Patrick Dughi (dughi@imaxx.net)
Date: 11/13/00


>   Basically, the buffer behaves differently for score than for other
> commands...when i type it, it will display the last line of text shown
> as the first line of the score sheet, be it mob name/desc, room text,
> etc.  If I hit score a second or multiple times, it will cumulatively
> add score sheets (so the second time, i get 2 more score sheets for a
> total of three, etc...to the point that the mud crashes).
>   The offending line is:  send_to_char(buf, ch)  When I take the rest of
> the code for score out, that line still behaves in the above
> manner...this is the same line that works perfectly for me in many other
> commands, including time and weather, which I have no problems with.
>   My question is this...is there a command to force a
> buffer purge, and if so what is it?  If not, how can I

        Okay. First, this isn't a stock bug.  It's your bug.  You made it.

        If I were to guess, I'd say somewhere in the score listing, you
changed/added a line so that instead of

        1) clearing buf (usually with the initial sprintf in circle)
                        or
        2) adding text to the buf string array with sprintf, strcat.

        it doesn't.

        Probably #1.  Buf is a global var, so if you don't clear it,
you'll simply continue to have the old value in it.  Since you always
append, it will simply keep including text to the point where you hit your
MAX_STRING_LENGTH'th character (which you obviously aren't checking for),
which attempts to write out of bounds for the buf array, and crashes the
mud.

                                        PjD


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



This archive was generated by hypermail 2b30 : 04/11/01 PDT