From 2d94337e1ac754f6181d537708fe3a187d2c7400 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 13 Aug 2008 06:22:04 +0000 Subject: (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. --- src/engine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/engine.cpp') diff --git a/src/engine.cpp b/src/engine.cpp index 3808c46a8..8f70f5109 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -487,7 +487,8 @@ static bool IsUniqueEngineName(const char *name) */ CommandCost CmdRenameEngine(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { - if (!IsEngineIndex(p1) || StrEmpty(_cmd_text)) return CMD_ERROR; + if (!IsEngineIndex(p1)) return CMD_ERROR; + if (StrEmpty(_cmd_text) || strlen(_cmd_text) >= MAX_LENGTH_ENGINE_NAME_BYTES) return CMD_ERROR; if (!IsUniqueEngineName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE); -- cgit v1.2.3-70-g09d2