From: H.G.Muller Date: Fri, 10 Oct 2025 13:11:15 +0000 (+0200) Subject: Fix loading of (noncompliant) wide PGN X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1bb95bf805d5bb135f1150b99351b2deba72c61f;p=xboard.git Fix loading of (noncompliant) wide PGN The PGN standard limits line length to 255 characters. But rather than clipping too-long lines, XBoard now tries to split such lines at a space. --- diff --git a/parser.c b/parser.c index 7e71619..99808fb 100644 --- a/parser.c +++ b/parser.c @@ -289,6 +289,7 @@ ReadLine () if(fromString) return 0; // parsing string, so the end is a hard end if(!inputFile) return 0; while((c = fgetc(inputFile)) != EOF) { + if(c == ' ' && inPtr - inputBuf > PARSEBUFSIZE/2) break; // break too-long lines *inPtr++ = c; if(c == '\n') { *inPtr = NULLCHAR; return 1; } if(inPtr - inputBuf > PARSEBUFSIZE-2) inPtr--; //prevent crash on overflow