summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-02-22 15:01:38 +0000
committertron <tron@openttd.org>2007-02-22 15:01:38 +0000
commitc8343206115a50afb27743937d6c477516cbfdb2 (patch)
tree95bc87b398c6672e870c7903ec57d36d724eb11e /src/newgrf.cpp
parent103d119c510a83c3b0cca20328ad4d87e8159d6a (diff)
downloadopenttd-c8343206115a50afb27743937d6c477516cbfdb2.tar.xz
(svn r8843) -Fix
-Fix: Off-by-one error in accessing a buffer (if you start at the second byte you have to subtract one from the size) Also avoid an unnecessary buffer copy and strlcpy() abuse NOTE: 0.5 candidate
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 9ddc095eb..7b5a47f3f 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2729,11 +2729,11 @@ static void GRFComment(byte *buf, int len)
*
* V ignored Anything following the 0C is ignored */
- static char comment[256];
if (len == 1) return;
- ttd_strlcpy(comment, (char*)(buf + 1), minu(sizeof(comment), len));
- grfmsg(2, "GRFComment: %s", comment);
+ int text_len = len - 1;
+ const char *text = (const char*)(buf + 1);
+ grfmsg(2, "GRFComment: %.*s", text_len, text);
}
/* Action 0x0D (GLS_SAFETYSCAN) */