diff options
Diffstat (limited to 'src/gui/userpalette.cpp')
-rw-r--r-- | src/gui/userpalette.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 9077da6c0..e378aef6c 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -183,7 +183,8 @@ UserPalette::~UserPalette() if (col->grad == STATIC || col->grad == PULSE) { char buffer[20]; - sprintf(buffer, "0x%06x", col->getRGB()); + snprintf(buffer, sizeof(buffer), "0x%06x", col->getRGB()); + buffer[19] = 0; config.setValue(configName, std::string(buffer)); } } @@ -286,7 +287,8 @@ void UserPalette::addColor(const unsigned type, const unsigned rgb, const std::string &configName = ColorTypeNames[type]; char buffer[20]; - sprintf(buffer, "0x%06x", rgb); + snprintf(buffer, sizeof(buffer), "0x%06x", rgb); + buffer[19] = 0; const std::string rgbString = config.getValue(configName, std::string(buffer)); |