Fix workspace limit segfault
wmaker keeps the names of all workspaces together in
the string 'buf' with fixed length of 1024, therefore
allowing buffer overflows if the number of workspaces
is big enough.
For the default names "Workspace X" (from 1 to 9)
and "Workspace XX" (from 10 to 99) etc, the approximate
number of workspaces necessary to make the buffer
overflow occur is 80, because
(11*9) + (71*12) + 80 = 1031
The fix is to set the size of 'buf' as
the maximum number of workspaces times their maximum
name length.
The problem was reported by John H. Robinson in the wmaker-dev
list ( http://lists.windowmaker.info/dev/msg00214.html ):
"http://www.youtube.com/watch?v=fkNJZvKwmhE
Michael reported a problem with Window Maker where it crashes with a
SIGSGV when trying to create an 82nd workspace.
/usr/local/WindowMaker-0.92.1pre/bin/wmaker warning: Window Maker exited
due to a crash (signal 11) and will be restarted.
I was able to reproduce it by making 81 workspaces, then creating an 82nd."
[ crmafra: Wrote the changelog ]