summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/resources/userpalette.cpp4
-rw-r--r--src/utils/stringutils.cpp10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/resources/userpalette.cpp b/src/resources/userpalette.cpp
index 16a19d19..12e4d5bc 100644
--- a/src/resources/userpalette.cpp
+++ b/src/resources/userpalette.cpp
@@ -121,7 +121,7 @@ UserPalette::~UserPalette()
if (color.grad == STATIC || color.grad == PULSE)
{
char buffer[20];
- sprintf(buffer, "0x%06x", color.getRGB());
+ snprintf(buffer, 20, "0x%06x", color.getRGB());
config.setValue(configName, std::string(buffer));
}
}
@@ -220,7 +220,7 @@ void UserPalette::addColor(int type, int rgb, Palette::GradientType grad,
{
const std::string &configName = ColorTypeNames[type];
char buffer[20];
- sprintf(buffer, "0x%06x", rgb);
+ snprintf(buffer, 20, "0x%06x", rgb);
const std::string rgbString = config.getValue(configName,
std::string(buffer));
unsigned int rgbValue = 0;
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 32fc3b0c..a1637892 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -73,11 +73,11 @@ const char *ipToString(int address)
{
static char asciiIP[16];
- sprintf(asciiIP, "%i.%i.%i.%i",
- (unsigned char)(address),
- (unsigned char)(address >> 8),
- (unsigned char)(address >> 16),
- (unsigned char)(address >> 24));
+ snprintf(asciiIP, 16, "%i.%i.%i.%i",
+ (unsigned char)(address),
+ (unsigned char)(address >> 8),
+ (unsigned char)(address >> 16),
+ (unsigned char)(address >> 24));
return asciiIP;
}