Login
User Name:

Password:



Register

Forgot your password?
 I3 and IMC
Dec 26, 2024 3:27 am
By GatewaySysop
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
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
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
Users Online
Bing

Members: 0
Guests: 16
Stats
Files
Topics
Posts
Members
Newest Member
496
3,808
19,708
594
MaisieMacl

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » 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 12:19 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,697
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 >>