Re: [BUGFIX] Improved Edit overflow fixed

From: Akuma/Chris Baggett/DOOMer (doomer@BAYOU.COM)
Date: 12/29/97


>        } else if (!action)
>                strcat(*d->str, "\r\n");
>
>It STILL cats \r\n to the end of the string, even if it is over the max
>length.
>The fix:
>        } else if (!action && (strlen(*d->str) > d->max_str))
>                strcat(*d->str, "\r\n");
Question: The problem was it cats to the end of the string even if it is
over the
max length.  Well, your solution still allows that problem.
if (!action  // nothing was entered, just a simple \r\n
    && (strlen(*d->str)   // length of the current string
        > d->max_str))    // is greater than the Max length
    strcat(*d->str, "\r\n"); // add a \r\n to the end of it.

ok, it would ONLY add the \r\n if the total length of the string
was greater than Max length, but if you pressed ENTER continuously,
it would NEVER add the \r\n.  You'd hafta constantly insert stuff.
You probably meant
                                   // -2 to account for the appendage of \r\n
if (!action && (strlen(*d->str) < (d->max_str - 2)))
   strcat(*d->str, "\r\n");

My  $((1 << 1)/100) worth.

Akuma the Raging Coder

  +------------------------------------------------------------+
  | "The poets talk about love, but what I talk about is DOOM, |
  |      because in the end, DOOM is all that counts." -       |
  |   Alex Machine/George Stark/Stephen King, The Dark Half    |
  |        "Nothing is IMPOSSIBLE, Just IMPROBABLE"            |
  |   "Easier Said Than Done, But Better Done Than Said..."    |
  +------------------------------------------------------------+


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