X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.c;h=481e7b241c47304398c21697f5f86b2ed8ae512d;hb=e6e38912837a4fe2464356408d10dee950b3121c;hp=08dc5131af11b0b219c497a28213d44daf16c760;hpb=829031aa78f85ced458ab253cdae852e01c751f2;p=xboard.git diff --git a/parser.c b/parser.c index 08dc513..481e7b2 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