dtwm: Fix window menus caused by using destination as param to snprintf
authorPeter Howkins <flibble@users.sf.net>
Fri, 13 Apr 2018 23:32:03 +0000 (00:32 +0100)
committerPeter Howkins <flibble@users.sf.net>
Fri, 13 Apr 2018 23:32:03 +0000 (00:32 +0100)
cde/programs/dtwm/WmResource.c

index c724e37368aab8fe1ce926472ac855b2f4e413ee..382d2f9472dc74dc38da37c0cbdf4e4fd93a9744 100644 (file)
@@ -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)