diff --git a/src/newgrf.cpp b/src/newgrf.cpp --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2651,12 +2651,9 @@ static ChangeInfoResult LoadTranslationT */ static std::string ReadDWordAsString(ByteReader *reader) { - char output[5]; - for (int i = 0; i < 4; i++) output[i] = reader->ReadByte(); - output[4] = '\0'; - StrMakeValidInPlace(output, lastof(output)); - - return std::string(output); + std::string output; + for (int i = 0; i < 4; i++) output.push_back(reader->ReadByte()); + return StrMakeValid(output); } /**