Commit 2041f82b authored by athomps's avatar athomps
Browse files

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
parent 869e9ba9
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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);