Segfault while in improved editor

From: Anton Graham (darkimage@programmer.net)
Date: 10/10/01


Hello all.  I am attempting to add an "info" command that essentially is
a
board that can be read from anywhere, by anyone, but only posted to by
LVL_GOD+.  Unfortunately, I have a repeatable seg fault while in the
improved
editor (as shown below).

Obvious exits:
North - [ 1200] The Meeting Room Of The Gods

Instructions: /s or @ to save, /h for more options.

% Connection to etruria closed by foreign host.
---- No world ----
___________________________________________________________________________11:11
[958h 100m 150v] winfo test yet again
] this is a test

The crash will not always occur after only one line of input, but will
usually..
Sometimes it will accept up to three before crashing.

The function that puts the char in the improved editor follows:
do_winfo(struct char_data *ch, char *argument, int cmd, int subcmd)
{
  struct info_entry entry;

  time_t t;
  if (!ch->desc) {
    send_to_char("You cannot write info articles.\r\n", ch);
    return;
  }

  if (*argument)
    skip_spaces(&argument);

  if (!(*argument)) {
    send_to_char("You must specify a subject for your info entry.\r\n",
ch);
    return;
  }

  entry.number = info_table[top_of_infot-1].number + 1;
  entry.from = str_dup(GET_NAME(ch));
  entry.subject = str_dup(CAP(argument));
  t = time(0);
  entry.date = str_dup(asctime(localtime(&t)));

  act("$n begins writing some info", TRUE, ch, NULL, NULL, TO_ROOM);
  send_editor_help(ch->desc);

  string_write(ch->desc, &entry.body, 4096, 0, NULL);
}

entry.body is a char *.  Yes, I know that there are a couple problems
with this
implementation, but until I can solve the editor crash, I'm sort of at a
loss.
Gdb output from the crash follows:

Program received signal SIGSEGV, Segmentation fault.
0x400d3d94 in free () from /lib/libc.so.6
(gdb) bt
#0  0x400d3d94 in free () from /lib/libc.so.6
#1  0x400d3d14 in free () from /lib/libc.so.6
#2  0x08080840 in process_input (t=0x84449f8) at ../comm.c:2284
#3  0x0807e590 in game_loop (mother_desc=5) at ../comm.c:839
#4  0x0807de92 in init_game (port=4444) at ../comm.c:503
#5  0x0807db0c in main (argc=3, argv=0xbffff6e4) at ../comm.c:374
#6  0x40071450 in __libc_start_main () from /lib/libc.so.6

--
Anton Graham                            GPG ID: 0x18F78541
<darkimage@bigfoot.com>                 RSA key available upon request

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