forked from lijiext/lammps
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:
parent
869e9ba92e
commit
2041f82bc4
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue