@@ -381,7 +381,7 @@ initial_solutions(int print)
381
381
}
382
382
if (print == TRUE )
383
383
{
384
- sprintf (token, " Initial solution %d.\t %.350s" ,
384
+ snprintf (token, sizeof (token) , " Initial solution %d.\t %.350s" ,
385
385
solution_ref.Get_n_user (), solution_ref.Get_description ().c_str ());
386
386
dup_print (token, FALSE );
387
387
}
@@ -521,7 +521,7 @@ initial_exchangers(int print)
521
521
}
522
522
if (print == TRUE )
523
523
{
524
- sprintf (token, " Exchange %d.\t %.350s" ,
524
+ snprintf (token, sizeof (token) , " Exchange %d.\t %.350s" ,
525
525
exchange_ptr->Get_n_user (), exchange_ptr->Get_description ().c_str ());
526
526
dup_print (token, FALSE );
527
527
}
@@ -613,7 +613,7 @@ initial_gas_phases(int print)
613
613
}
614
614
if (print == TRUE )
615
615
{
616
- sprintf (token, " Gas_Phase %d.\t %.350s" ,
616
+ snprintf (token, sizeof (token) , " Gas_Phase %d.\t %.350s" ,
617
617
gas_phase_ptr->Get_n_user (), gas_phase_ptr->Get_description ().c_str ());
618
618
dup_print (token, FALSE );
619
619
}
@@ -664,7 +664,7 @@ initial_gas_phases(int print)
664
664
}
665
665
if (fabs (gas_phase_ptr->Get_total_p () - use.Get_solution_ptr ()->Get_patm ()) > 5 )
666
666
{
667
- sprintf (token,
667
+ snprintf (token, sizeof (token) ,
668
668
" WARNING: While initializing gas phase composition by equilibrating:\n %s (%.2f atm) %s (%.2f atm).\n %s." ,
669
669
" Gas phase pressure" ,
670
670
(double ) gas_phase_ptr->Get_total_p (),
@@ -835,7 +835,7 @@ reactions(void)
835
835
for (reaction_step = 1 ; reaction_step <= count_steps; reaction_step++)
836
836
{
837
837
overall_iterations = 0 ;
838
- sprintf (token, " Reaction step %d." , reaction_step);
838
+ snprintf (token, sizeof (token) , " Reaction step %d." , reaction_step);
839
839
if (reaction_step > 1 && incremental_reactions == FALSE )
840
840
{
841
841
copy_use (-2 );
@@ -941,7 +941,7 @@ saver(void)
941
941
942
942
if (save.solution == TRUE )
943
943
{
944
- sprintf (token, " Solution after simulation %d." , simulation);
944
+ snprintf (token, sizeof (token) , " Solution after simulation %d." , simulation);
945
945
description_x = token;
946
946
n = save.n_solution_user ;
947
947
xsolution_save (n);
@@ -1032,7 +1032,7 @@ xexchange_save(int n_user)
1032
1032
temp_exchange.Set_n_user (n_user);
1033
1033
temp_exchange.Set_n_user_end (n_user);
1034
1034
temp_exchange.Set_new_def (false );
1035
- sprintf (token, " Exchange assemblage after simulation %d." , simulation);
1035
+ snprintf (token, sizeof (token) , " Exchange assemblage after simulation %d." , simulation);
1036
1036
temp_exchange.Set_description (token);
1037
1037
temp_exchange.Set_solution_equilibria (false );
1038
1038
temp_exchange.Set_n_solution (-999 );
@@ -1115,7 +1115,7 @@ xgas_save(int n_user)
1115
1115
*/
1116
1116
temp_gas_phase.Set_n_user (n_user);
1117
1117
temp_gas_phase.Set_n_user_end (n_user);
1118
- sprintf (token, " Gas phase after simulation %d." , simulation);
1118
+ snprintf (token, sizeof (token) , " Gas phase after simulation %d." , simulation);
1119
1119
temp_gas_phase.Set_description (token);
1120
1120
temp_gas_phase.Set_new_def (false );
1121
1121
temp_gas_phase.Set_solution_equilibria (false );
@@ -2102,18 +2102,18 @@ run_simulations(void)
2102
2102
#endif
2103
2103
2104
2104
#if defined PHREEQCI_GUI
2105
- sprintf (token, " \n Simulation %d\n " , simulation);
2105
+ snprintf (token, sizeof (token) , " \n Simulation %d\n " , simulation);
2106
2106
screen_msg (token);
2107
2107
#endif
2108
- sprintf (token, " Reading input data for simulation %d." , simulation);
2108
+ snprintf (token, sizeof (token) , " Reading input data for simulation %d." , simulation);
2109
2109
2110
2110
dup_print (token, TRUE );
2111
2111
if (read_input () == EOF)
2112
2112
break ;
2113
2113
2114
2114
if (title_x.size () > 0 )
2115
2115
{
2116
- sprintf (token, " TITLE" );
2116
+ snprintf (token, sizeof (token) , " TITLE" );
2117
2117
dup_print (token, TRUE );
2118
2118
if (pr.headings == TRUE )
2119
2119
{
0 commit comments