more buffer overflow avoiding through using snprintf()

This commit is contained in:
Axel Kohlmeyer
2018-09-06 09:57:43 -04:00
parent fbc1c1cfdd
commit 4d52cb9245
9 changed files with 26 additions and 26 deletions

View File

@ -362,7 +362,7 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
FILE *fp = force->open_potential(file);
if (fp == NULL) {
char str[128];
sprintf(str,"Cannot open file %s",file);
snprintf(str,128,"Cannot open file %s",file);
error->one(FLERR,str);
}