Login
User Name:

Password:



Register

Forgot your password?
Overland with Bitmaps
Jul 4, 2025 11:57 pm
By Samson
void nanny_get_new_race -- comm.c
Mar 13, 2025 7:08 am
By Elwood
IPv6
Jan 25, 2025 10:45 pm
By Samson
mudstrlcpy and mudstrlcat
Jan 18, 2025 5:23 pm
By Samson
I3 and IMC
Jan 17, 2025 9:35 pm
By Samson
SWFotEFUSS 1.5.3
Author: Various
Submitted by: Samson
SWRFUSS 1.4.3
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.8
Author: Various
Submitted by: Samson
AFKMud 2.5.2
Author: AFKMud Team
Submitted by: Samson
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
Users Online
Anthropic, Meta, AhrefsBot, Amazonbot, Yandex, DotBot

Members: 0
Guests: 4
Stats
Files
Topics
Posts
Members
Newest Member
507
3,812
19,725
594
Bardecome

» SmaugMuds » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Previous fix for delete...
Forum Rules | Mark all | Recent Posts

[Bug] Previous fix for deleted rooms is itself a crash vector
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Nov 5, 2006 2:39 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,708
JoinedJan 1, 2002

 
Bug: Previous fix for deleted rooms is itself a crash vector
Danger: High - Legitimately missing vnums will now cause a crash instead
Discovered in: AFKMud 1.77
Found by: Kigen
Fixed by: Kigen

---

handler.c, char_to_room

Locate:
   if( !get_room_index( pRoomIndex->vnum ) )
      pRoomIndex = NULL;

   if( !pRoomIndex )
   {
      bug( "Char_to_room: %s -> NULL room!  Putting char in limbo (%d)", ch->name, ROOM_VNUM_LIMBO );
      /*
       * This used to just return, but there was a problem with crashing
       * and I saw no reason not to just put the char in limbo.  -Narn
       */
      pRoomIndex = get_room_index( ROOM_VNUM_LIMBO );
      if( !pRoomIndex )
      {
         bug( "FATAL: char_to_room: Limbo room is MISSING! Expect crash! %s:%s, line %d", __FILE__, __FUNCTION__, __LINE__ );
         return FALSE;
      }
   }


Change to:
   if( !pRoomIndex || !get_room_index( pRoomIndex->vnum ) )
   {
      bug( "Char_to_room: %s -> NULL room!  Putting char in limbo (%d)", ch->name, ROOM_VNUM_LIMBO );
      /*
       * This used to just return, but there was a problem with crashing
       * and I saw no reason not to just put the char in limbo.  -Narn
       */
      pRoomIndex = get_room_index( ROOM_VNUM_LIMBO );
      if( !pRoomIndex )
      {
         bug( "FATAL: char_to_room: Limbo room is MISSING! Expect crash! %s:%s, line %d", __FILE__, __FUNCTION__, __LINE__ );
         return FALSE;
      }
   }


The order of the checks turned out to be a really REALLY bad idea. While it would have sufficed in the case of deleted rooms which the person ended up standing in due to a bad pointer, checking the vnum of a truly missing pRoomIndex value would result in a crash. So while the original fix did work, it generated itself a brand new bug that wasn't caught. This fix now addresses both issues with the proper logic.

Pages:<< prev 1 next >>