From 16982f6cae6415f935f18b602d5ab3eefd1ea6af Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 29 Apr 2016 16:16:52 +0200 Subject: [PATCH] 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. --- dialogs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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 -- 1.7.0.4