Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl

Members: 0
Guests: 3
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Astral walk not safegua...
Forum Rules | Mark all | Recent Posts

[Bug] Astral walk not safeguarded against characters leaving the room
< Newer Topic :: Older Topic > AFKMud 1.64

Pages:<< prev 1 next >>
Post is unread #1 Jan 9, 2005, 12:37 pm   Last edited Nov 13, 2005, 11:59 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Astral walk spell is not safeguarded against characters leaving the room.
Discovered in: AFKMud 1.64
Danger: High - Potential pointer corruption + potential game crash.
Found by: Samson
Fixed by: Samson

---

magic.c, spell_astral_walk:

Locate:

SPELLF spell_astral_walk( int sn, int level, CHAR_DATA *ch, void *vo )
{
    ROOM_INDEX_DATA *location, *original;
    CHAR_DATA *vch;

    if ( ( location = get_room_index( astral_target ) ) == NULL
     || IS_ROOM_FLAG( ch->in_room, ROOM_NO_ASTRAL ) || IS_AREA_FLAG( ch->in_room->area, AFLAG_NOASTRAL ) )
    {
        send_to_char( "&[magic]A mysterious force prevents you from opening a gateway.\n\r", ch );
        return rSPELL_FAILED;
    }

    act( AT_MAGIC, "$n opens a gateway in the air, and steps through onto another plane!", ch, NULL, NULL, TO_ROOM );

    original = ch->in_room;
    leave_map( ch, NULL, location );

    act( AT_MAGIC, "You open a gateway onto another plane!", ch, NULL, NULL, TO_CHAR );
    act( AT_MAGIC, "$n appears from a gateway in thin air!", ch, NULL, NULL, TO_ROOM );

    for ( vch = original->first_person; vch; vch = vch->next_in_room )
    {
        if ( !is_same_group( vch, ch ) )
            continue;

          act( AT_MAGIC, "The gateway remains open long enough for you to follow $s through.", ch, NULL, vch, TO_VICT );
          leave_map( vch, ch, location );
    }

    astral_target = number_range( 4350, 4449 );
    return rNONE;
}


Replace with:

SPELLF spell_astral_walk( int sn, int level, CHAR_DATA *ch, void *vo )
{
   ROOM_INDEX_DATA *location, *original;
   CHAR_DATA *vch, *vch_next;

   if ( ( location = get_room_index( astral_target ) ) == NULL
    || IS_ROOM_FLAG( ch->in_room, ROOM_NO_ASTRAL ) || IS_AREA_FLAG( ch->in_room->area, AFLAG_NOASTRAL ) )
   {
      send_to_char( "&[magic]A mysterious force prevents you from opening a gateway.\n\r", ch );
      return rSPELL_FAILED;
   }

   act( AT_MAGIC, "$n opens a gateway in the air, and steps through onto another plane!", ch, NULL, NULL, TO_ROOM );

   original = ch->in_room;
   leave_map( ch, NULL, location );

   act( AT_MAGIC, "You open a gateway onto another plane!", ch, NULL, NULL, TO_CHAR );
   act( AT_MAGIC, "$n appears from a gateway in thin air!", ch, NULL, NULL, TO_ROOM );

   for( vch = original->first_person; vch; vch = vch_next )
   {
      vch_next = vch->next_in_room;

      if( !is_same_group( vch, ch ) )
         continue;

      act( AT_MAGIC, "The gateway remains open long enough for you to follow $s through.", ch, NULL, vch, TO_VICT );
      leave_map( vch, ch, location );
   }
   astral_target = number_range( 4350, 4449 );
   return rNONE;
}


The loop through the characters in the room does not take into account that people are leaving, unlinking their pointers in the process. Astral Walk is a group spell in AFKMud and multiple characters can be removed from the room at one time.

This bug is not present in other Smaug codebases.
       
Pages:<< prev 1 next >>