summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-25 23:10:35 +0000
committerrubidium <rubidium@openttd.org>2010-11-25 23:10:35 +0000
commit4e6d29351e3232cfb749e3ac0c7116aca18d44f1 (patch)
tree926575e1415a35a4442bafdc9acd449db6b60137
parent09e88969cfe3fc38fdf13deeccd5d1322689552f (diff)
downloadopenttd-4e6d29351e3232cfb749e3ac0c7116aca18d44f1.tar.xz
(svn r21326) -Fix: off-by-one in case choice list construction causing case lists to fail completely
-rw-r--r--src/newgrf_text.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index fcaa0e746..2a4f7f63f 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -327,21 +327,19 @@ struct UnmappedChoiceList : ZeroedMemoryAllocator {
*d++ = i;
/* "<LENn>" */
- size_t len = strlen(str);
+ size_t len = strlen(str) + 1;
*d++ = GB(len, 8, 8);
*d++ = GB(len, 0, 8);
/* "<STRINGn>" */
memcpy(d, str, len);
d += len;
- *d++ = '\0';
}
/* "<STRINGDEFAULT>" */
- size_t len = strlen(this->strings[0]);
+ size_t len = strlen(this->strings[0]) + 1;
memcpy(d, this->strings[0], len);
d += len;
- *d++ = '\0';
} else {
if (this->type == SCC_PLURAL_LIST) {
*d++ = lm->plural_form;