Re: [BUFFER] Bufffer overflow

From: Dana Luther (dtluther@mindspring.com)
Date: 08/11/00


-----Original Message-----
From: Brian Beffa <MortalCity@aol.com>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Friday, August 11, 2000 3:45 PM
Subject: Re: [CIRCLE] [BUFFER] Bufffer overflow


>I dont know why it would make a diff including this because i never changed
>the code for levels, but here it is:
>
>Just a reminder, when I type levels for 3 of my classes, the mud shutsdown
>from an overflow.
>
>ACMD(do_levels)
>{
>  int i;
>
>  if (IS_NPC(ch)) {
>    send_to_char("You ain't nothin' but a hound-dog.\r\n", ch);
>    return;
>  }
>  *buf = '\0';
>
>  for (i = 1; i < LVL_IMMORT; i++) {
>    sprintf(buf + strlen(buf), "[%2d] %8d-%-8d : ", i,
>            level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i+1) -
1);
>    switch (GET_SEX(ch)) {
>    case SEX_MALE:
>    case SEX_NEUTRAL:
>      strcat(buf, title_male(GET_CLASS(ch), i));
>      break;
>    case SEX_FEMALE:
>      strcat(buf, title_female(GET_CLASS(ch), i));
>      break;
>    default:
>      send_to_char("Oh dear.  You seem to be sexless.\r\n", ch);
>      break;
>    }
>    strcat(buf, "\r\n");
>  }
>  sprintf(buf + strlen(buf), "[%2d] %8d          : Immortality\r\n",
>          LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT));
>  page_string(ch->desc, buf, 1);
>}
>
>thanks,
>brian


I think the point was that it is printing WAY too much stuff into that
buffer when you try to print all the level info out like that. You need to
break it into chunks.

Dana


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