From d62c5667cff2eed82deb18e28d98345500b30d3f Mon Sep 17 00:00:00 2001 From: Loïc Guilloux Date: Tue, 4 Jan 2022 22:12:05 +0100 Subject: Fix #9766: Don't write uninitialised data in config file (#9767) --- src/settings.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/settings.cpp b/src/settings.cpp index f61976028..4decfecf3 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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); -- cgit v1.2.3-70-g09d2