avoid array overflows and silence compiler warnings

This commit is contained in:
Axel Kohlmeyer 2018-11-20 22:40:46 -05:00
parent 090fc7bc8a
commit 385cf2e1fc
3 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ int Init_Output_Files( reax_system *system, control_params *control,
output_controls *out_control, mpi_datatypes *mpi_data,
char *msg )
{
char temp[MAX_STR];
char temp[MAX_STR+8];
int ret;
if( out_control->write_steps > 0 ){

View File

@ -43,7 +43,7 @@ int Tokenize( char* s, char*** tok )
char *word;
int count=0;
strncpy( test, s, MAX_LINE );
strncpy( test, s, MAX_LINE-1);
for( word = strtok(test, sep); word; word = strtok(NULL, sep) ) {
strncpy( (*tok)[count], word, MAX_LINE );

View File

@ -315,7 +315,7 @@ int Init_Traj( reax_system *system, control_params *control,
output_controls *out_control, mpi_datatypes *mpi_data,
char *msg )
{
char fname[MAX_STR];
char fname[MAX_STR+8];
int atom_line_len[ NR_OPT_ATOM ] = { 0, 0, 0, 0,
ATOM_BASIC_LEN, ATOM_wV_LEN,
ATOM_wF_LEN, ATOM_FULL_LEN };