Re: buffer overflow

From: John Evans (evansj@HI-LINE.NET)
Date: 01/31/98


On Sat, 31 Jan 1998, Michael J. Fara wrote:

> Anyone have a problem where if you execute certain commands that increase
> the buffer size you get an overflow? For example:
>
> 500hp 100mp 82mv > olist 0 10000
> (361 listings appear here)
>   362. [ 5208] a sturdy iron shield
>   363. [ 5210] a black potion
>   364. [ 5211] an orange potion
>   365. [ 5213] a green serpentine staff
>   366. [ 5214] a smooth quartz ball
> **OVERFLOW**

Ick. 10,000 objs in a list? That's quite a few.

What I did on my olist, mlist, rlist, etc... was limit people to listing
only 100 things at a time.

Like so:

  two_arguments(argument, buf, buf2);

  if (!*buf || !*buf2) {
    send_to_char("Usage: olist <begining number> <ending number>\r\n",ch);
    return;
  }
  first = atoi(buf);
  last = atoi(buf2);
  if (first >= last) {
    send_to_char("Second value must be greater than first.\r\n", ch);
    return;
  }
  if ((last - first) > 100) {
    send_to_char("You can only list 100 things at a time.\r\n", ch);
    return;
  }


John Evans <evansj@hi-line.net>  --  http://www.hi-line.net/~evansj/

Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke


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