Increased MAXLINE and added overflow check in substitute()

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@193 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
athomps 2006-12-14 22:30:51 +00:00
parent 869e9ba92e
commit 2041f82bc4
1 changed files with 9 additions and 1 deletions

View File

@ -46,7 +46,7 @@
#undef AtomInclude
#undef CommandInclude
#define MAXLINE 1024
#define MAXLINE 2048
#define DELTA 4
/* ---------------------------------------------------------------------- */
@ -358,7 +358,15 @@ void Input::substitute(char *str, int flag)
*ptr = '\0';
strcpy(work,str);
if (strlen(work)+strlen(value) >= MAXLINE) {
sprintf(str,"Input line too long after variable substitution: %s %s",work,value);
error->one(str);
}
strcat(work,value);
if (strlen(work)+strlen(beyond) >= MAXLINE) {
sprintf(str,"Input line too long after variable substitution: %s %s",work,beyond);
error->one(str);
}
strcat(work,beyond);
strcpy(str,work);
ptr += strlen(value);