From 4651ad94fec7cd45cd174aa7ad4fc6c45b09ce4e Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Jul 2022 10:03:57 +0200 Subject: [PATCH] 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. --- src/road.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/road.cpp b/src/road.cpp index 788c611654..d143ae652d 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -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); } /**