Fix #9766: Don't write uninitialised data in config file (#9767)

This commit is contained in:
Loïc Guilloux 2022-01-04 22:12:05 +01:00 committed by GitHub
parent 57b992717b
commit d62c5667cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -357,6 +357,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);