When no WorkSpaces {} are defined in your .ctwmrc, parts of the
structure used to track them aren't initialized properly in the code.
This can lead to crashes when those pointers are dereferenced; I came
across it in the "TwmWindows" menu.  I've pushed up a fix for this;
see attached patch.

I have a sneaky suspicion there are more such land mines scattered
through the code   :|


-- 
Matthew Fuller     (MF4839)   |  [EMAIL PROTECTED]
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.
#
#
# patch "workmgr.c"
#  from [cbbb225102a852d23956bec573e7e10b61620c54]
#    to [2d59af82aea7cee7cc29bb3db7f77be30fcb3fed]
#
============================================================
--- workmgr.c   cbbb225102a852d23956bec573e7e10b61620c54
+++ workmgr.c   2d59af82aea7cee7cc29bb3db7f77be30fcb3fed
@@ -168,8 +168,14 @@ void ConfigureWorkSpaceManager (void) {
     virtualScreen *vs;
 
     for (vs = Scr->vScreenList; vs != NULL; vs = vs->next) {
-       WorkSpaceWindow *wsw = (WorkSpaceWindow*) malloc (sizeof 
(WorkSpaceWindow));
-       wsw->twm_win         = (TwmWindow*) 0;
+       /*
+        * Make sure this is all properly initialized to nothing.  Otherwise
+        * bad and undefined behavior can show up in certain cases (e.g.,
+        * with no Workspaces {} defined in .ctwmrc, the only defined
+        * workspace will be random memory bytes, which can causes crashes on
+        * e.g.  f.menu "TwmWindows".)
+        */
+       WorkSpaceWindow *wsw = (WorkSpaceWindow*) calloc (1, sizeof 
(WorkSpaceWindow));
        wsw->state = Scr->workSpaceMgr.initialstate; /* BUTTONSSTATE */
        vs->wsw = wsw;
     }

Reply via email to