3131
3232
3333// C++ Includes
34- #include <cstdio> // for std::sprintf
34+ #include <cstdio> // for std::snprintf
3535#include <memory>
3636#include <numeric> // for std::partial_sum
3737#include <set>
@@ -1334,7 +1334,7 @@ void System::write_header (Xdr & io,
13341334 {
13351335 // set up the comment
13361336 comment = "# Name, Variable No. " ;
1337- std ::sprintf (buf , "%u" , var );
1337+ std ::snprintf (buf , 80 , "%u" , var );
13381338 comment += buf ;
13391339 comment += ", System \"" ;
13401340 comment += this -> name ();
@@ -1348,7 +1348,7 @@ void System::write_header (Xdr & io,
13481348 {
13491349 // set up the comment
13501350 comment = "# Subdomains, Variable \"" ;
1351- std ::sprintf (buf , "%s" , this -> variable_name (var ).c_str ());
1351+ std ::snprintf (buf , 80 , "%s" , this -> variable_name (var ).c_str ());
13521352 comment += buf ;
13531353 comment += "\", System \"" ;
13541354 comment += this -> name ();
@@ -1366,7 +1366,7 @@ void System::write_header (Xdr & io,
13661366 {
13671367 // set up the comment
13681368 comment = "# Approximation Order, Variable \"" ;
1369- std ::sprintf (buf , "%s" , this -> variable_name (var ).c_str ());
1369+ std ::snprintf (buf , 80 , "%s" , this -> variable_name (var ).c_str ());
13701370 comment += buf ;
13711371 comment += "\", System \"" ;
13721372 comment += this -> name ();
@@ -1382,7 +1382,7 @@ void System::write_header (Xdr & io,
13821382 // do the same for radial_order
13831383 {
13841384 comment = "# Radial Approximation Order, Variable \"" ;
1385- std ::sprintf (buf , "%s" , this -> variable_name (var ).c_str ());
1385+ std ::snprintf (buf , 80 , "%s" , this -> variable_name (var ).c_str ());
13861386 comment += buf ;
13871387 comment += "\", System \"" ;
13881388 comment += this -> name ();
@@ -1399,7 +1399,7 @@ void System::write_header (Xdr & io,
13991399 {
14001400 // set up the comment
14011401 comment = "# FE Family, Variable \"" ;
1402- std ::sprintf (buf , "%s" , this -> variable_name (var ).c_str ());
1402+ std ::snprintf (buf , 80 , "%s" , this -> variable_name (var ).c_str ());
14031403 comment += buf ;
14041404 comment += "\", System \"" ;
14051405 comment += this -> name ();
@@ -1412,7 +1412,7 @@ void System::write_header (Xdr & io,
14121412#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
14131413
14141414 comment = "# Radial FE Family, Variable \"" ;
1415- std ::sprintf (buf , "%s" , this -> variable_name (var ).c_str ());
1415+ std ::snprintf (buf , 80 , "%s" , this -> variable_name (var ).c_str ());
14161416 comment += buf ;
14171417 comment += "\", System \"" ;
14181418 comment += this -> name ();
@@ -1422,7 +1422,7 @@ void System::write_header (Xdr & io,
14221422 io .data (radial_fam , comment .c_str ());
14231423
14241424 comment = "# Infinite Mapping Type, Variable \"" ;
1425- std ::sprintf (buf , "%s" , this -> variable_name (var ).c_str ());
1425+ std ::snprintf (buf , 80 , "%s" , this -> variable_name (var ).c_str ());
14261426 comment += buf ;
14271427 comment += "\", System \"" ;
14281428 comment += this -> name ();
@@ -1457,7 +1457,7 @@ void System::write_header (Xdr & io,
14571457 // 9.)
14581458 // write the name of the cnt-th additional vector
14591459 comment = "# Name of " ;
1460- std ::sprintf (buf , "%dth vector" , cnt ++ );
1460+ std ::snprintf (buf , 80 , "%dth vector" , cnt ++ );
14611461 comment += buf ;
14621462 std ::string vec_name = pr .first ;
14631463
0 commit comments