Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
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
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Yahoo!, Bing, Sogou

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWFOTE FUSS Bugfix List » [Bug] Memory leak in setrank ...
Forum Rules | Mark all | Recent Posts

[Bug] Memory leak in setrank command
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Nov 6, 2005, 1:36 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Memory leak in setrank command
Danger: High - String memory corruption and possible crash.
Found by: Keberus/Odis
Fixed by: Odis

This bugfix has been adapted from the SWFOTE 2.0 recode project.

---

act_info.c, do_setrank

Locate:
   if( !str_cmp( argument, "none" ) )
   {
      if( vict->rank )
         STRFREE( vict->rank );
      vict->rank = STRALLOC( "                  " );
      ch_printf( ch, "You have removed %s's rank.\n\r", PERS( vict, ch ) );
      ch_printf( vict, "%s has removed your rank.\n\r", PERS( ch, vict ) );
      return;
   }


Change to:
   if( !str_cmp( argument, "none" ) )
   {
      if( vict->rank )
         DISPOSE( vict->rank );
      vict->rank = str_dup( "                  " );
      ch_printf( ch, "You have removed %s's rank.\n\r", PERS( vict, ch ) );
      ch_printf( vict, "%s has removed your rank.\n\r", PERS( ch, vict ) );
      return;
   }


The classic mismatching of STRFREE with a str_dup string. The rank value is allocated during pfile read as a non-hashed string and when the character is disposed of during logout/quit the value is deallocated as a non-hashed string. But because the setrank command uses STRFREE and then STRALLOC on the same value, it will lead to eventual corruption of the string hash and probably a crash.
       
Pages:<< prev 1 next >>