X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.c;h=8e31362f373187f120a844cdf7c72b0a51a9720e;hb=fcc8546ae23f9aed992cd222bb1b9cab6ac642c1;hp=6da13d40b7c73700ee52e2de2dabbe149e928ed4;hpb=c2d598e998107fe4d483b1976ce2d6fd494c88a7;p=xboard.git diff --git a/parser.c b/parser.c index 6da13d4..8e31362 100644 --- a/parser.c +++ b/parser.c @@ -1,7 +1,7 @@ /* * parser.c -- * - * Copyright 2011, 2012, 2013 Free Software Foundation, Inc. + * Copyright 2011, 2012, 2013, 2014 Free Software Foundation, Inc. * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -174,6 +174,10 @@ NextUnit (char **p) if(fromString) return 0; // we are parsing string, so the end is really the end *p = inPtr = inputBuf; if(!ReadLine()) return 0; // EOF + } else if(inPtr > inputBuf + PARSEBUFSIZE/2) { // buffer fills up with already parsed stuff + char *q = *p, *r = inputBuf; + while(*r++ = *q++); + *p = inputBuf; inPtr = r - 1; } parseStart = oldp = *p; // remember where we begin