Pages:<< prev 1 next >>
Black Hand

GroupAdministrators
Posts3,708
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:
Change to:
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:
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 >>