[CODE][MAJOR BUG]Crash in editor, Affects practically every Circlemud

From: James Slattery (badlands@mchsi.com)
Date: 03/03/03


Hey all,
  Well, I'm new to the mailing list so hi! Anyways, I've perused these messages
before quite some time:reading, learning, blah blah blah.

The bug I've discovered affects practically every CircleMud with the editor in
it. Want to see it for yourself? Go to an empty buffer such as... a description
for a player. /c it out.. put in

/ra ' ' ' '

Watch it crash. Well, the fix I've come up for this may not be correct but, in
improved-edit.c around line 150, put this in.

    } else if ((t = strtok(NULL, "'")) == NULL) {
      write_to_output(d, "Replacement string must be enclosed in single
quotes.\r\n");
      return;
+      /*wb's fix for empty buffer replacement crashing */
+       } else if ((!s) || (!t) || (!*d->str)) {
+         return;

    } else if ((total_len = ((strlen(t) - strlen(s)) + strlen(*d->str))) <= d-
>max_str) {
      if ((replaced = replace_str(d->str, s, t, rep_all, d->max_str)) > 0) {
        write_to_output(d, "Replaced %d occurance%sof '%s' with '%s'.\r\n",
replaced, ((replaced != 1) ? "s " : " "), s, t);
      } else if (replaced == 0) {


Wiseblood of Badlands Mud
telnet:mudhost.com:4000

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



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