summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-09-09 15:52:49 +0000
committerfrosch <frosch@openttd.org>2012-09-09 15:52:49 +0000
commit2ec61361135d004300f3f7f1071d7fd6f8cf204d (patch)
tree29d38bca50cf5fb32f6cd3b36ac2904dd5a23b56
parent8c8207dcc820a204d26c6c680fa2c22adb29e826 (diff)
downloadopenttd-2ec61361135d004300f3f7f1071d7fd6f8cf204d.tar.xz
(svn r24515) -Fix: GStexts were compied incompletely when containing certain string codes.
-rw-r--r--src/game/game_text.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp
index 4ffaa9e54..4085d5d25 100644
--- a/src/game/game_text.cpp
+++ b/src/game/game_text.cpp
@@ -183,7 +183,10 @@ struct TranslationWriter : LanguageWriter {
void Write(const byte *buffer, size_t length)
{
- *this->strings->Append() = strndup((const char*)buffer, length);
+ char *dest = MallocT<char>(length + 1);
+ memcpy(dest, buffer, length);
+ dest[length] = '\0';
+ *this->strings->Append() = dest;
}
};