From: H.G.Muller Date: Fri, 29 Apr 2016 14:16:52 +0000 (+0200) Subject: Prevent crash on help-click for engine without manual X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=ff21bd1b1c3a47cc0cf17d4c11125d18b53f30d8 Prevent crash on help-click for engine without manual The error message of "man w xxx" when no man entry for xxx exists appears on stderr, which is not caught by popen(). As a result the path to the man file gets set to an empty string, and saveStrCpy is not so save that it can copy an empty string, but quits XBoard through an ASSERT in that case. --- diff --git a/dialogs.c b/dialogs.c index d3b333e..9b48704 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2691,7 +2691,9 @@ DisplayHelp (char *name) FREE(manText[1]); manText[1] = NULL; // so any currently held text is worthless safeStrCpy(tidy, buf, MSG_SIZ); // remember current engine eng = BufferCommandOutput(tidy, MSG_SIZ); // obtain path to its man file + if(*eng) safeStrCpy(engMan, eng, strlen(eng)); // and remember that too + else *engMan = NULLCHAR; FREE(eng); } safeStrCpy(buf, engMan, MSG_SIZ); n = 1; // use engine man