Login
User Name:

Password:



Register

Forgot your password?
 sting skill
Jan 7, 2025 7:32 pm
By Remcon
 south command
Jan 7, 2025 7:22 pm
By Remcon
 mphate
Jan 7, 2025 7:16 pm
By Remcon
 do_setliquid
Jan 7, 2025 3:22 pm
By Remcon
 Array overrun and incorrect string macros used in do_setclass
Jan 7, 2025 3:20 am
By Samson
Help.are for SmaugFUSS1.9.5
Author: Smaug
Submitted by: Remcon
LOP 1.6
Author: Remcon
Submitted by: Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
Users Online
Anthropic, Bytespider, Yandex

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
495
3,819
19,758
589
ReubenKeat

» SmaugMuds » Codebases » SmaugFUSS » num_skills possible issue.
Forum Rules | Mark all | Recent Posts

num_skills possible issue.
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 5, 2025 12:52 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005

 
in tables.c you'll find this function. notice the sn <= num_skills in the for loop everywhere else it is just < num_skills.
void remap_slot_numbers(  )
{
   SKILLTYPE *skill;
   SMAUG_AFF *aff;
   char tmp[32];
   int sn;

   log_string( "Remapping slots to sns" );

   for( sn = 0; sn <= num_skills; ++sn )
   {
      if( ( skill = skill_table[sn] ) != NULL )
      {
         for( aff = skill->first_affect; aff; aff = aff->next )
            if( aff->location == APPLY_WEAPONSPELL
                || aff->location == APPLY_WEARSPELL
                || aff->location == APPLY_REMOVESPELL
                || aff->location == APPLY_STRIPSN || aff->location == APPLY_RECURRINGSPELL )
            {
               snprintf( tmp, 32, "%d", slot_lookup( atoi( aff->modifier ) ) );
               DISPOSE( aff->modifier );
               aff->modifier = str_dup( tmp );
            }
      }
   }
}

Post is unread #2 Jan 6, 2025 4:23 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,713
JoinedJan 1, 2002

 
I wonder what the point of that function even is, but good catch. Once someone managed to hit 500 skills on their MUD it would have gone beyond the end of the array.

FWIW, this was added in Smaug 1.4.

Post is unread #3 Jan 6, 2025 5:38 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,988
JoinedJul 26, 2005

 
Lol I went and looked at LOP and it had that same issue lol.

Pages:<< prev 1 next >>