1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 20:49:11 +00:00

Fix: commands with a RoadType in their arguments were not validated properly (#9944)

Although it was checked that RoadType was not 63 (INVALID_ROADTYPE),
and all values lower than 63 are fine, it also allowed values higher
than 63. As the RoadType is a "byte", it could contain values up
to 255.
This commit is contained in:
Patric Stout
2022-07-09 10:03:57 +02:00
committed by GitHub
parent 6810d09c1b
commit 4651ad94fe

View File

@@ -141,7 +141,7 @@ bool HasAnyRoadTypesAvail(CompanyID company, RoadTramType rtt)
*/
bool ValParamRoadType(RoadType roadtype)
{
return roadtype != INVALID_ROADTYPE && HasRoadTypeAvail(_current_company, roadtype);
return roadtype < ROADTYPE_END && HasRoadTypeAvail(_current_company, roadtype);
}
/**