From: Peter Howkins Date: Fri, 13 Apr 2018 23:32:03 +0000 (+0100) Subject: dtwm: Fix window menus caused by using destination as param to snprintf X-Git-Tag: 2.2.4a~77 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b410e644c09b79ef4092e63b5a6fdeeda944d3cd;p=oweals%2Fcde.git dtwm: Fix window menus caused by using destination as param to snprintf --- diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c index c724e373..382d2f94 100644 --- a/cde/programs/dtwm/WmResource.c +++ b/cde/programs/dtwm/WmResource.c @@ -202,6 +202,7 @@ void InitBuiltinSystemMenu(void) #endif /* WSM */ char *CloString = NULL; char dsm[2048]; + char dsmtemp[sizeof(dsm)]; Boolean gotItAll; gotItAll = True; if(gotItAll) @@ -404,11 +405,13 @@ void InitBuiltinSystemMenu(void) #ifdef WSM if (DtwmBehavior) { - snprintf(dsm, sizeof(dsm), "%s%s\n%s\n%s\n no-label f.separator\n", + snprintf(dsmtemp, sizeof(dsmtemp), "%s%s\n%s\n%s\n no-label f.separator\n", dsm, OcpString, OcaString, RemString); + strcpy(dsm, dsmtemp); } #endif /* WSM */ - snprintf(dsm, sizeof(dsm), "%s%s\n}", dsm, CloString); + snprintf(dsmtemp, sizeof(dsmtemp), "%s%s\n}", dsm, CloString); + strcpy(dsm, dsmtemp); if ((builtinSystemMenu = (char *)XtMalloc ((unsigned int) (strlen(dsm) + 1))) == NULL)