Re: [Code] Strange error.

From: Ronald Fenner (
Date: 01/10/03

On Thursday, January 9, 2003, at 03:31  AM, Jeremy Maloney wrote:

> Hello folks, I'm in mid swing on installing and converting the
> guild-improved.tar.gz system into a patch level 17. Through it all,
> I've
> managed to get it to compile without complaint, but I'm experiencing a
> strange crash bug. Mortals who do the commands don't crash us, but
> Immortals who do it, crash us hard. Here's an example of the code.
> ACMD(do_allguilds)
> {
>   struct guild_data *g;
>   int i, num;
>   *buf = '\0';
>   for (i = 1; i <= MAX_GUILD_TYPES; i++) {
>    g = guilds_data;
>    sprintf(buf, "%s\r\n      &c%s list&n\r\n", buf, guild_types[i]);
I'd suggest every where you have something like the line above you
instead add something like:

sprintf(temp, "\r\n    &c%s list&n\r\n", guild_types[i]);
strcat(buf, temp);

reason for this is i remember seeing somewhere that it's possible
sprintf could overwrite the end of your buffer before your finished
using it.

looking over the gdb info you provided line 444 isn't in stock which
means you patched the paging system.
> #0  0x80bc716 in page_string (d=0x816fc08,
>     str=0x811a000 "\r\n      &cTribe list&n\r\n
> &R==========&n\r\n\r\n\r\n      &cOrganization list&n\r\n      &R", '='
> <repeats 17 times>, "&n\r\n\r\n\r\n\r\n", keep_internal=1) at
> modify.c:444
> 444       lines = MAX(GET_LINES(d->character), 10);
the only thing that could be wrong here is that d->character isn't
pointing to a valid character. I'm going to assume that your getting a
bad access error when it crashes so you should start looking at
variable d and back track through your code to see whats going on also
it helps to run the mud in gdb and set up a breakpoint before the line
in question gets called and examine the variables that it uses to make
sure they are valid.

anyways happy bug hunting


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/26/03 PDT