The first patch is an attempt to correct this bug. I did test for a
maximum of 1000 workspaces, feel free to try more :)

The second patch is to prevent any over-sizing of workspace names it
could crash wmaker; not succeeded yet in crashing it.

Samir
# HG changeset patch
# User Samir SAADA <[email protected]>
# Date 1240164004 -7200
# Node ID 35e0150adeae838a5b691c0168787c6e0fab2f68
# Parent  5a2507602c48324fba0f07754a442a8cc6ab967c
fixing workspace limit segfault

diff --git a/src/wmspec.c b/src/wmspec.c
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -826,7 +826,7 @@
 static void
 updateWorkspaceNames(WScreen *scr)
 {
-    char buf[1024], *pos;
+    char buf[MAX_WORKSPACES*(MAX_WORKSPACENAME_WIDTH+1)], *pos;
     unsigned int i, len, curr_size;
 
     pos = buf;
# HG changeset patch
# User Samir SAADA <[email protected]>
# Date 1240168055 -7200
# Node ID 1efc7b4f3d116c7cd3b06cdd1780ecb7d1c6bb7a
# Parent  35e0150adeae838a5b691c0168787c6e0fab2f68
prevent too big workspace names

diff --git a/src/wmspec.c b/src/wmspec.c
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -833,7 +833,7 @@
     len = 0;
     for(i = 0; i < scr->workspace_count; i++) {
         curr_size = strlen(scr->workspaces[i]->name);
-        strcpy(pos, scr->workspaces[i]->name);
+        strncpy(pos, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
         pos += (curr_size+1);
         len += (curr_size+1);
     }

Reply via email to