Safeguard against possible string overflow

This commit is contained in:
Richard Berger
2020-11-02 10:52:59 -05:00
parent 584943fc92
commit e8337fd128

View File

@ -183,7 +183,7 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) :
for (int j = 0; j < DUMP_NC_MAX_DIMS; j++) {
perat[inc].field[j] = -1;
}
strcpy(perat[inc].name, mangled);
strncpy(perat[inc].name, mangled, NC_FIELD_NAME_MAX);
n_perat++;
}