Re: Segfault while in improved editor

From: Mike Breuer (mbreuer@new.rr.com)
Date: 10/10/01


----- Original Message -----
From: "Anton Graham" <darkimage@programmer.net>

> do_winfo(struct char_data *ch, char *argument, int cmd, int subcmd)
> {
>   struct info_entry entry;
-- snip --
>   string_write(ch->desc, &entry.body, 4096, 0, NULL);
> }

This may not be the only problem, but...

string_write() expects a pointer to a string that will continue to exist
as the user continues to pass commands/text to the improved editor.  You
are passing a member of "entry" which will be deallocated as soon as the
do_winfo exits.  You should attach your string to the char's descriptor
in some way.  Take a look at some of the other places where string_write
is called.

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST