protect against possible buffer overflow

This commit is contained in:
Axel Kohlmeyer 2019-04-04 16:51:37 -04:00
parent 78bab6ee39
commit ab5c3b0386
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 4 additions and 4 deletions

View File

@ -99,8 +99,8 @@ void FixTuneKspace::init()
error->all(FLERR,"Cannot use fix tune/kspace with dipole long-range solver");
double old_acc = force->kspace->accuracy/force->kspace->two_charge_force;
char old_acc_str[12];
sprintf(old_acc_str,"%g",old_acc);
char old_acc_str[16];
snprintf(old_acc_str,16,"%g",old_acc);
strcpy(new_acc_str,old_acc_str);
int itmp;
@ -210,8 +210,8 @@ void FixTuneKspace::store_old_kspace_settings()
strcpy(old_kspace_style,force->kspace_style);
strcpy(new_kspace_style,old_kspace_style);
double old_acc = force->kspace->accuracy_relative;
char old_acc_str[12];
sprintf(old_acc_str,"%g",old_acc);
char old_acc_str[16];
snprintf(old_acc_str,16,"%g",old_acc);
strcpy(new_pair_style,force->pair_style);
strcpy(base_pair_style,force->pair_style);
char *trunc;