Skip to content

Commit

Permalink
Fix OpenTTD#9766: Don't write uninitialised data in config file (Open…
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 authored and TrueBrain committed Apr 2, 2022
1 parent 0966f7b commit 6494597
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/settings.cpp
Expand Up @@ -356,6 +356,10 @@ void OneOfManySettingDesc::FormatValue(char *buf, const char *last, const void *
void ManyOfManySettingDesc::FormatValue(char *buf, const char *last, const void *object) const
{
uint bitmask = (uint)this->Read(object);
if (bitmask == 0) {
buf[0] = '\0';
return;
}
bool first = true;
for (uint id : SetBitIterator(bitmask)) {
if (!first) buf = strecpy(buf, "|", last);
Expand Down

0 comments on commit 6494597

Please sign in to comment.