summaryrefslogtreecommitdiff
path: root/src/Fl_Color_Chooser.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-26 16:12:18 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-26 16:12:18 +0200
commit2ffd4e4f1af16b17a286ff354603a717f5d828a5 (patch)
tree99e2d4a7e2fde8e3abb027eb687901440750ee00 /src/Fl_Color_Chooser.cxx
parent53d9614adbb728fc4db983c9bb817c6eea870994 (diff)
Replace all calls to sprintf() by calls to snprintf().
Diffstat (limited to 'src/Fl_Color_Chooser.cxx')
-rw-r--r--src/Fl_Color_Chooser.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Fl_Color_Chooser.cxx b/src/Fl_Color_Chooser.cxx
index 643ba4f3c..08307a8da 100644
--- a/src/Fl_Color_Chooser.cxx
+++ b/src/Fl_Color_Chooser.cxx
@@ -100,7 +100,7 @@ static const Fl_Menu_Item mode_menu[] = {
#ifndef FL_DOXYGEN
int Flcc_Value_Input::format(char* buf) {
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
- if (c->mode() == M_HEX) return sprintf(buf,"0x%02X", int(value()));
+ if (c->mode() == M_HEX) return snprintf(buf, 5,"0x%02X", int(value()));
else return Fl_Valuator::format(buf);
}
#endif // !FL_DOXYGEN
@@ -465,7 +465,7 @@ void Fl_Color_Chooser::mode(int newMode)
static int copy_rgb(double r, double g, double b) {
char buf[8];
int len;
- len = sprintf(buf, "%02X%02X%02X", int(r * 255 + .5), int(g * 255 + .5), int(b * 255 + .5));
+ len = snprintf(buf, 8, "%02X%02X%02X", int(r * 255 + .5), int(g * 255 + .5), int(b * 255 + .5));
Fl::copy(buf, len, 1);
// printf("copied '%s' to clipboard\n", buf); // Debug
return 1;