summaryrefslogtreecommitdiff
path: root/src/group_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-13 06:22:04 +0000
committerrubidium <rubidium@openttd.org>2008-08-13 06:22:04 +0000
commit2d94337e1ac754f6181d537708fe3a187d2c7400 (patch)
tree4d5843494903387aa4370746ec69c55363be9a66 /src/group_cmd.cpp
parent97c184f8f8265cf59b24ab3081a032c7162afcb5 (diff)
downloadopenttd-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/group_cmd.cpp')
-rw-r--r--src/group_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 331feda34..44bfd12c1 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -170,7 +170,8 @@ static bool IsUniqueGroupName(const char *name)
*/
CommandCost CmdRenameGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- if (!IsValidGroupID(p1) || StrEmpty(_cmd_text)) return CMD_ERROR;
+ if (!IsValidGroupID(p1)) return CMD_ERROR;
+ if (StrEmpty(_cmd_text) || strlen(_cmd_text) >= MAX_LENGTH_GROUP_NAME_BYTES) return CMD_ERROR;
Group *g = GetGroup(p1);
if (g->owner != _current_player) return CMD_ERROR;