diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-09-26 16:12:18 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-09-26 16:12:18 +0200 |
| commit | 2ffd4e4f1af16b17a286ff354603a717f5d828a5 (patch) | |
| tree | 99e2d4a7e2fde8e3abb027eb687901440750ee00 /src/Fl_Preferences.cxx | |
| parent | 53d9614adbb728fc4db983c9bb817c6eea870994 (diff) | |
Replace all calls to sprintf() by calls to snprintf().
Diffstat (limited to 'src/Fl_Preferences.cxx')
| -rw-r--r-- | src/Fl_Preferences.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index d77824ed6..ddb521102 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -584,7 +584,7 @@ char Fl_Preferences::get( const char *key, int &value, int defaultValue ) { \return 0 if setting the value failed */ char Fl_Preferences::set( const char *key, int value ) { - sprintf( nameBuffer, "%d", value ); + snprintf( nameBuffer, sizeof(nameBuffer), "%d", value ); node->set( key, nameBuffer ); return 1; } @@ -1081,7 +1081,7 @@ int Fl_Preferences::dirty() { */ Fl_Preferences::Name::Name( unsigned int n ) { data_ = (char*)malloc(20); - sprintf(data_, "%u", n); + snprintf(data_, 20, "%u", n); } /** @@ -1442,7 +1442,7 @@ void Fl_Preferences::Node::setParent( Node *pn ) { parent_ = pn; next_ = pn->first_child_; pn->first_child_ = this; - sprintf( nameBuffer, "%s/%s", pn->path_, path_ ); + snprintf( nameBuffer, sizeof(nameBuffer), "%s/%s", pn->path_, path_ ); free( path_ ); path_ = fl_strdup( nameBuffer ); } @@ -1460,7 +1460,7 @@ Fl_Preferences::RootNode *Fl_Preferences::Node::findRoot() { // add a child to this node and set its path (try to find it first...) Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path ) { - sprintf( nameBuffer, "%s/%s", path_, path ); + snprintf( nameBuffer, sizeof(nameBuffer), "%s/%s", path_, path ); char *name = fl_strdup( nameBuffer ); Node *nd = find( name ); free( name ); |
