Skip to content
Snippets Groups Projects
Commit 17aff29f authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

fix off-by-one bug when copying strings

parent f96b9e0d
No related branches found
No related tags found
No related merge requests found
...@@ -255,11 +255,11 @@ void PairQUIP::coeff(int narg, char **arg) ...@@ -255,11 +255,11 @@ void PairQUIP::coeff(int narg, char **arg)
error->all(FLERR,"Incorrect args for pair coefficients"); error->all(FLERR,"Incorrect args for pair coefficients");
n_quip_file = strlen(arg[2]); n_quip_file = strlen(arg[2]);
quip_file = new char[n_quip_file]; quip_file = new char[n_quip_file+1];
strcpy(quip_file,arg[2]); strcpy(quip_file,arg[2]);
n_quip_string = strlen(arg[3]); n_quip_string = strlen(arg[3]);
quip_string = new char[n_quip_string]; quip_string = new char[n_quip_string+1];
strcpy(quip_string,arg[3]); strcpy(quip_string,arg[3]);
for (int i = 4; i < narg; i++) { for (int i = 4; i < narg; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment