From e883ca1d4e6643a31784d6363552c3862eed46c7 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 9 Sep 2012 15:52:49 +0000 Subject: [PATCH] (svn r24515) -Fix: GStexts were compied incompletely when containing certain string codes. --- src/game/game_text.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 4ffaa9e549..4085d5d252 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(length + 1); + memcpy(dest, buffer, length); + dest[length] = '\0'; + *this->strings->Append() = dest; } };