summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-05-22 21:06:03 +0200
committerMichael Lutz <michi@icosahedron.de>2019-05-23 00:08:39 +0200
commitb73622a01ca5d2a72593c4f7ff985cfb5532cc0c (patch)
treeea92469fe019b88674f7bd444f704d95d1598dda
parentc1d26d8884f92443b7fa94380881f794a402bba4 (diff)
downloadopenttd-b73622a01ca5d2a72593c4f7ff985cfb5532cc0c.tar.xz
Fix #7600: Don't read uninitialised memory when parsing GS language files.
-rw-r--r--src/game/game_text.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp
index 412f2804f..b69b8f46b 100644
--- a/src/game/game_text.cpp
+++ b/src/game/game_text.cpp
@@ -111,7 +111,7 @@ std::unique_ptr<LanguageStrings> ReadRawLanguageStrings(const char *file)
while (i > 0 && (buffer[i - 1] == '\r' || buffer[i - 1] == '\n' || buffer[i - 1] == ' ')) i--;
buffer[i] = '\0';
- ret->lines.emplace_back(buffer, buffer + to_read - 1);
+ ret->lines.emplace_back(buffer, i);
if (len > to_read) {
to_read = 0;