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, Yahoo!, DotBot

Members: 0
Guests: 9
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] Adding a room affect fa...
Forum Rules | Mark all | Recent Posts

[Bug] Adding a room affect fails under most conditions
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Oct 9, 2006, 12:44 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Adding a room affect fails under most conditions
Danger: Medium - Code makes use of uninitialized variables
Discovered in: AFKMud 1.77
Found by: Samson
Fixed by: Samson

---

build.c, do_redit

Locate:
      else if( loc == APPLY_RESISTANT || loc == APPLY_IMMUNE || loc == APPLY_SUSCEPTIBLE || loc == APPLY_ABSORB )
      {
         char *risa = arg3;
         char flag[MIL];

         while( risa[0] != '\0' )
         {
            risa = one_argument( risa, flag );
            value = get_risflag( flag );

            if( value < 0 || value >= MAX_RIS_FLAG )
               ch_printf( ch, "Unknown flag: %s\n\r", flag );
            else
            {
               xSET_BIT( risabit, value );
               found = true;
            }
         }
      }
      else if( loc == APPLY_WEAPONSPELL
               || loc == APPLY_WEARSPELL
               || loc == APPLY_REMOVESPELL || loc == APPLY_STRIPSN || loc == APPLY_RECURRINGSPELL || loc == APPLY_EAT_SPELL )
      {
         value = skill_lookup( arg3 );

         if( !IS_VALID_SN( value ) )
            ch_printf( ch, "Invalid spell: %s", arg3 );
         else
            found = true;
      }
      else
      {
         value = atoi( arg3 );
         found = true;
      }
      if( !found )
         return;


Change to:
      else if( loc == APPLY_RESISTANT || loc == APPLY_IMMUNE || loc == APPLY_SUSCEPTIBLE || loc == APPLY_ABSORB )
      {
         char *risa = argument;
         char flag[MIL];

         while( risa[0] != '\0' )
         {
            risa = one_argument( risa, flag );
            value = get_risflag( flag );

            if( value < 0 || value >= MAX_RIS_FLAG )
               ch_printf( ch, "Unknown flag: %s\n\r", flag );
            else
            {
               xSET_BIT( risabit, value );
               found = true;
            }
         }
      }
      else if( loc == APPLY_WEAPONSPELL
               || loc == APPLY_WEARSPELL
               || loc == APPLY_REMOVESPELL || loc == APPLY_STRIPSN || loc == APPLY_RECURRINGSPELL || loc == APPLY_EAT_SPELL )
      {
         value = skill_lookup( argument );

         if( !IS_VALID_SN( value ) )
            ch_printf( ch, "Invalid spell: %s", argument );
         else
            found = true;
      }
      else
      {
         value = atoi( argument );
         found = true;
      }
      if( !found )
         return;


Most of the flag checking in the redit command for adding room affects is seriously flawed. The flags are checked via the arg3 string, which is never initialized to anything before reaching this point in the function. So it will be attempting to apply affects which were not intended because the value of arg3 is unpredictable. This bug is likely the result of previous work done to reduce the use of static char[] string declarations for memory saving.
       
Pages:<< prev 1 next >>