Re: Autorun Segmentation Fault [LONG]

From: Mike Stilson (
Date: 08/22/02

On Thu, Aug 22, 2002 at 01:03:08PM -0400, Josh Harris wrote:
>is what I get when I do frame 2 then list
> 0x0807bd23 in fread_string (fl=0x80e74c8, error=0x80da360 "room #0") at
>2271        CREATE(rslt, char, length + 2);
>(gdb) l
>2266        }
>2267      } while (!done);
>2269      /* allocate space for the new string and copy it */
>2270      if (strlen(buf) > 0) {
>2271        CREATE(rslt, char, length + 2);
>2272        strcpy(rslt, buf);
>2273      }  else
>2274        rslt = NULL;
>no it's not stock code.  I've changed db.c, and others a lot.  I was
>running the mud on my home computer (Win98 system w/ cygwin) and it
>compiled and ran.  Then I got a webserver(Linux) and uploaded it there.
Well, let's see.

<gdb lesson>
after you did "frame 2", I'd say to try:
p rslt
p length
</gdb lesson>

Make sure those are both initialized and sane values.

rslt is defined as "char *result = NULL;" right?
length is calculated properly somewhere above this (iow, it's not holding
some random bit of garbage with a value of like 103949324 or whatever)

>Thanks for your help
np, but you really should read some of the docs on gdb.  It's your
best friend.

Most installations you can use "info gdb" from a shell and get lots of
detail about it.  Also, gdb has lots of built-in help.

BTW, why bother with CREATE() then strcpy rather than just
rslt=buf?strdup(buf):NULL;  (assuming you have buf declared as
char *buf=NULL)

or if you're using the stock "char buf[MSL];"


(unless you're doing something you specifically need the 2 extra chars


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

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