From e8337fd128f61c8af971897e2b28b9a6a0e90ce6 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 2 Nov 2020 10:52:59 -0500 Subject: [PATCH] Safeguard against possible string overflow --- src/USER-NETCDF/dump_netcdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp index a50e01ce95..e1a8dfab69 100644 --- a/src/USER-NETCDF/dump_netcdf.cpp +++ b/src/USER-NETCDF/dump_netcdf.cpp @@ -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++; }