From: H.G. Muller Date: Tue, 3 Jan 2012 10:29:00 +0000 (+0100) Subject: Fix crash in auto-comment X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=c245d8f55ee094707771e5225dd91564ded4630c;hp=a6cb149215f419331165e3f8e484bcc492e7b9b1;p=xboard.git Fix crash in auto-comment Trailing linefeeds in AppendComment were not properly stripped off, leading to a mismatch between the allocted and used memory, and thus possible buffer overruns. --- diff --git a/backend.c b/backend.c index a3b0f0c..02cc45e 100644 --- a/backend.c +++ b/backend.c @@ -14903,6 +14903,7 @@ if(appData.debugMode) fprintf(debugFP, "Append: in='%s' %d\n", text, addBraces); while (*text == '\n') text++; len = strlen(text); while (len > 0 && text[len - 1] == '\n') len--; + text[len] = NULLCHAR; if (len == 0) return;