more buffer overflow avoiding through using snprintf()
This commit is contained in:
@ -269,7 +269,7 @@ void WriteRestart::write(char *file)
|
||||
fp = fopen(hfile,"wb");
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open restart file %s",hfile);
|
||||
snprintf(str,128,"Cannot open restart file %s",hfile);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
if (multiproc) delete [] hfile;
|
||||
@ -334,7 +334,7 @@ void WriteRestart::write(char *file)
|
||||
fp = fopen(multiname,"wb");
|
||||
if (fp == NULL) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open restart file %s",multiname);
|
||||
snprintf(str,128,"Cannot open restart file %s",multiname);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
write_int(PROCSPERFILE,nclusterprocs);
|
||||
|
||||
Reference in New Issue
Block a user