Re: [code fix] liblist

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


On Wed, 10 Sep 1997, Patrick J. Dughi wrote:

>> BOOM, the mud crashes...
>> to many items I belive, but here is a little pit to handle that.. it
>> will take and make it so you cant list more then 300 items....

>list, just check for something like if (strlen(buf-you're-using-to-save) +
>strlen(buf-you're-going-to-add) > MAX_SIZE_OF_THE_BUF-YOU'RE_USING_TO_SAVE)
>and if so, then page_string() it out then.  The only problem I have with

It'd be better to something like this:
  if (sprintf(buf, "blah") + length > MAX_LENGTH)
    <break>;
  else
    length += sprintf(buf2 + length, "%s", buf2);

>        Hmm. George - does your buffer system fix this? Haven't had time
>to think lately, much less code and test.

The buffer system should detect the overrun and reboot without crashing.
Or you can set it up to just continue after an overrun but that's not too
safe in theory.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | 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/08/00 PST