Re: Rather odd error.

From: George Greer (greerga@circlemud.org)
Date: 03/26/99


On Fri, 26 Mar 1999, Patrick Dughi wrote:

>#0  0x8058cab in perform_immort_where (ch=0x20202020,
>    arg=0x20202020 <Address 0x20202020 out of bounds>)
>    at act.informative.c:3010

0x20 = 32 = ' '

>        Obviously its overwriting memory somewhere (as opposed to trying
>to do a string comparison or the like on a null string), but where, I
>cannot see.  Aside from actually sitting down and debugging it for real,
>anyone seen this before, or have any ideas?

Here's something to try:

    for (i = character_list; i; i = i->next)
      if (CAN_SEE(ch, i) && i->in_room != NOWHERE && isname(arg, i->player.name)) {
        found = 1;
-        sprintf(buf, "M%3d. %-25s - [%5d] %s\r\n", ++num, GET_NAME(i),
-                GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name);
+        if (snprintf(buf, MAX_STRING_LENGTH, ...the above...) < 0)
+          log("Overflow: " (+ the above snprintf format));
        send_to_char(buf, ch);
      }

If that doesn't get it, try:

void print_object_location(int num, struct obj_data * obj,
        struct char_data *ch, int recur)
{
  int off = 0;

  if (num > 0)
    off += sprintf(buf, "O%3d. %-25s - ", num, obj->short_description);
  else
    off += sprintf(buf, "%33s", " - ");

  if (obj->in_room > NOWHERE) {
    if (snprintf(buf + off, MAX_STRING_LENGTH - off,
                "[%5d] %s\r\n",
            GET_ROOM_VNUM(IN_ROOM(obj)), world[obj->in_room].name) < 0)
        log("Overflow: [%5d] %s", GET_ROOM_VNUM(IN_ROOM(obj)),
                world[obj->in_room].name);

  ...rest as above...

--
George Greer            | Stock Bug Reporting or Help
greerga@circlemud.org   | http://bugs.circlemud.org/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST