Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
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, Yahoo!, Google

Members: 0
Guests: 22
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » [Bug] Help file loader does n...
Forum Rules | Mark all | Recent Posts

[Bug] Help file loader does not recognize a corrupted helps.dat file
< Newer Topic :: Older Topic > AFKMud 2.02

Pages:<< prev 1 next >>
Post is unread #1 Oct 14, 2007, 10:19 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: Help file loader does not recognize a corrupted helps.dat file
Danger: Critical - Continuing to parse a corrupted file leaves undefined results in memory. Can also lead to data loss.
Discovered in: AFKMud 2.02
Found by: Toadvile
Fixed by: Samson

---

help.cpp, load_helps

Locate:
      if( key == "#HELP" )
         help = new help_data;

      if( key == "Keywords" )
      {
         stream.getline( buf, MSL );
         value = buf;
         strip_lspace( value );
         help->keyword = str_dup( value.c_str() );
      }

      if( key == "Level" )
      {
         stream.getline( buf, MSL );
         value = buf;
         strip_lspace( value );

         help->level = atoi( value.c_str() );
      }

      if( key == "Text" )
      {
         stream.getline( buf, MSL, '¢' );
         value = buf;
         strip_lspace( value );
         help->text = str_dup( value.c_str() );
      }

      if( key == "End" )
         helplist.push_back( help );


Change to:
      if( key == "#HELP" )
         help = new help_data;

      else if( key == "Keywords" )
      {
         stream.getline( buf, MSL );
         value = buf;
         strip_lspace( value );
         help->keyword = str_dup( value.c_str() );
      }

      else if( key == "Level" )
      {
         stream.getline( buf, MSL );
         value = buf;
         strip_lspace( value );

         help->level = atoi( value.c_str() );
      }

      else if( key == "Text" )
      {
         stream.getline( buf, MSL, '¢' );
         value = buf;
         strip_lspace( value );
         help->text = str_dup( value.c_str() );
      }

      else if( key == "End" )
         helplist.push_back( help );

      else
      {
         stream.getline( buf, MSL );
         value = buf;
         strip_lspace( value );
         log_printf( "Bad line in help file: %s %s", key.c_str(), value.c_str() );
      }


Because this routine was poorly written ( I'm still rather new to C++ and file streams ) it would not cause any log messages to appear about a corrupted file format. As a result of this the mud owner/admin is led to believe there are no problems. However there is a very real possibility of incomplete data being saved back to the helps.dat file causing data loss. The undetected corrupted help entry could also lead to a game crash if it's accessed.

The related corrupt help entry which led to this bug's discovery should be repaired as well:

#HELP
Level 104
Keywords LIQUIDTYPES
Text Liquid Type
------------------------------
water
beer
wine
ale
dark ale
whiskey
lemonade
firebreather
local specialty
slime mold juice
milk
tea
coffee
blood
salt water
cola
mead
grog
orange juice
vodka

See also: OSET, ITEMVALUES.
¢
End
       
Pages:<< prev 1 next >>