summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 305544137..36f3db9e3 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1502,7 +1502,8 @@ static bool IsUniqueVehicleName(const char *name)
*/
CommandCost CmdNameVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- if (!IsValidVehicleID(p1) || StrEmpty(_cmd_text)) return CMD_ERROR;
+ if (!IsValidVehicleID(p1)) return CMD_ERROR;
+ if (StrEmpty(_cmd_text) || strlen(_cmd_text) >= MAX_LENGTH_VEHICLE_NAME_BYTES) return CMD_ERROR;
Vehicle *v = GetVehicle(p1);