diff options
author | rubidium <rubidium@openttd.org> | 2008-08-13 06:22:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-08-13 06:22:04 +0000 |
commit | 2d94337e1ac754f6181d537708fe3a187d2c7400 (patch) | |
tree | 4d5843494903387aa4370746ec69c55363be9a66 /src/station_cmd.cpp | |
parent | 97c184f8f8265cf59b24ab3081a032c7162afcb5 (diff) | |
download | openttd-2d94337e1ac754f6181d537708fe3a187d2c7400.tar.xz |
(svn r14064) -Fix [FS#1752]: check for the length of strings (in bytes) in the command. Checking for the length in pixels is impossible because that differs per client.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 5ba071c21..8f8ef13b6 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2809,7 +2809,9 @@ static bool IsUniqueStationName(const char *name) */ CommandCost CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { - if (!IsValidStationID(p1) || StrEmpty(_cmd_text)) return CMD_ERROR; + if (!IsValidStationID(p1)) + if (StrEmpty(_cmd_text) || strlen(_cmd_text) >= MAX_LENGTH_STATION_NAME_BYTES) return CMD_ERROR; + Station *st = GetStation(p1); if (!CheckOwnership(st->owner)) return CMD_ERROR; |