Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, dbnu, DotBot, Google

Members: 1
Guests: 5
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Clan member count is no...
Forum Rules | Mark all | Recent Posts

[Bug] Clan member count is not safeguarded against going negative
< Newer Topic :: Older Topic > AFKMud 1.64

Pages:<< prev 1 next >>
Post is unread #1 Feb 28, 2005, 5:49 pm   Last edited Nov 13, 2005, 11:53 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: Clan member count is not safeguarded against going negative in do_mset and do_outcast
Discovered in: AFKMud 1.64
Danger: Trivial ( if pfile clean is on ) / Low ( if pfile cleanup is off ) - Incorrect counter value
Found by: Celestria
Fixed by: Celestria

---

build.c, do_mset

Locate:

	    /* Added a check on immortals so immortals don't take up
	     * any membership space. --Shaddai
	     */
	   if( !IS_IMMORTAL( victim ) ) 
	    {
  	        --victim->pcdata->clan->members; 
	        save_clan( victim->pcdata->clan );
	    }


Change to:

	    /* Added a check on immortals so immortals don't take up
	     * any membership space. --Shaddai
	     */
	   if( !IS_IMMORTAL( victim ) ) 
	    {
  	        --victim->pcdata->clan->members; 
                if( victim->pcdata->clan->members < 0 )
                   victim->pcdata->clan->members = 0;
	        save_clan( victim->pcdata->clan );
	    }


Locate:

	if( victim->pcdata->clan != NULL && !IS_IMMORTAL( victim ) )
	{
		--victim->pcdata->clan->members; 
	        save_clan( victim->pcdata->clan );
      }


Change to:

	if( victim->pcdata->clan != NULL && !IS_IMMORTAL( victim ) )
	{
		--victim->pcdata->clan->members; 
                if( victim->pcdata->clan->members < 0 )
                   victim->pcdata->clan->members = 0;
	        save_clan( victim->pcdata->clan );
      }


clans.c, do_outcast

Locate:

   if( victim->speaking & LANG_CLAN )
        victim->speaking = LANG_COMMON;
    REMOVE_BIT( victim->speaks, LANG_CLAN );
    --clan->members;


Change to:

   if( victim->speaking & LANG_CLAN )
        victim->speaking = LANG_COMMON;
    REMOVE_BIT( victim->speaks, LANG_CLAN );
    --clan->members;
    if( clan->members < 0 )
       clan->members = 0;


This is only really a problem if the pfile cleanup is off. Clans with member counts of 0 should probably be deleted automatically anyway. If the pfile cleanup code is on and a clan with < 1 member is found, it gets deleted.
       
Pages:<< prev 1 next >>