From 1bb95bf805d5bb135f1150b99351b2deba72c61f Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 10 Oct 2025 15:11:15 +0200 Subject: [PATCH] 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. --- parser.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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 -- 1.7.0.4