From: Peter Howkins Date: Tue, 3 Jul 2018 17:25:03 +0000 (+0100) Subject: dticon: fix for \n being truncated by snprintf off end of error message X-Git-Tag: 2.3.0a~235 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0f87b893549ed765f799c47a371ad5cfb0ffde02;p=oweals%2Fcde.git dticon: fix for \n being truncated by snprintf off end of error message --- diff --git a/cde/programs/dticon/utils.c b/cde/programs/dticon/utils.c index 49654fb9..a4324ade 100644 --- a/cde/programs/dticon/utils.c +++ b/cde/programs/dticon/utils.c @@ -2292,8 +2292,8 @@ SaveSession( void ) if ((fd = creat(path, S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP)) == -1) { tmpStr = GETSTR(16,24, "Couldn't save session to file"); - tmpStr2 = (char *)XtMalloc(strlen(tmpStr) + strlen(path)+ 3); - snprintf(tmpStr2, strlen(tmpStr) + strlen(path) + 3, "%s: %s\n", tmpStr, path); + tmpStr2 = (char *)XtMalloc(strlen(tmpStr) + strlen(path) + 4); /* +4 = ':', ' ', '\n' and '\0' */ + snprintf(tmpStr2, strlen(tmpStr) + strlen(path) + 4, "%s: %s\n", tmpStr, path); _DtSimpleErrnoError(progName, DtError, NULL, tmpStr2, NULL); XtFree(tmpStr2); XtFree ((char *)path);