From: H.G.Muller Date: Tue, 22 Mar 2016 08:41:44 +0000 (+0100) Subject: Prevent crash on loading empty game file X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=c3bb2a9ecf439c10d4bb03b7ac09b0773832e257 Prevent crash on loading empty game file The parser code is made resistant to loading a file with 0 characters in it. --- diff --git a/parser.c b/parser.c index c2eda2b..e325005 100644 --- a/parser.c +++ b/parser.c @@ -404,7 +404,7 @@ NextUnit (char **p) if(**p == NULLCHAR) { // make sure there is something to parse if(fromString) return 0; // we are parsing string, so the end is really the end - *p = inPtr = inputBuf; + *p = inPtr = parseStart = inputBuf; if(!ReadLine()) return 0; // EOF } else if(inPtr > inputBuf + PARSEBUFSIZE/2) { // buffer fills up with already parsed stuff char *q = *p, *r = inputBuf;