Changeset - r11219:26310c825384
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2009-02-24 22:57:02
smatz@openttd.org
(svn r15572) -Fix (r13730): theoretical buffer overflow when company with too long name funded a road reconstruction
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/town_cmd.cpp
Show inline comments
 
@@ -2197,15 +2197,15 @@ static void TownActionRoadRebuild(Town *
 
{
 
	t->road_build_months = 6;
 

	
 
	char *company_name = MallocT<char>(64);
 
	char company_name[MAX_LENGTH_COMPANY_NAME_BYTES];
 
	SetDParam(0, _current_company);
 
	GetString(company_name, STR_COMPANY_NAME, company_name + 64);
 

	
 
	GetString(company_name, STR_COMPANY_NAME, lastof(company_name));
 

	
 
	char *cn = strdup(company_name);
 
	SetDParam(0, t->index);
 
	SetDParamStr(1, company_name);
 

	
 
	AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
 
		NS_GENERAL, t->xy, 0, company_name);
 
	SetDParamStr(1, cn);
 

	
 
	AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING, NS_GENERAL, t->xy, 0, cn);
 
}
 

	
 
static bool DoBuildStatueOfCompany(TileIndex tile, TownID town_id)
0 comments (0 inline, 0 general)