Fwd: BUGFIX: avoid core dumps in kdelibs

Maks Orlovich mo002j at mail.rochester.edu
Sat Jul 12 15:36:13 BST 2003


The following was posted to kde-devel; but seems more on-topic (and a lot
more likely to be seen..) here. 
,--------------- Forwarded message (begin)

 Subject: BUGFIX: avoid core dumps in kdelibs
 From: Marc Espie <espie at nerim.net>
 Date: Sat, 12 Jul 2003 10:10:08 -0400
 Newsgroup: kde.kde-devel

 Some windows have an empty name. On some OSes, dereferencing name[-1] will
 access non-existent memory and result in core-dumps.
 
 Something like this should be committed both to the 3.1 branch and to
 -current.
 
 Okay ?
 
 --- kdeui/kmainwindow.cpp.orig Mon Jun 16 01:06:11 2003
 +++ kdeui/kmainwindow.cpp      Mon Jun 16 01:06:52 2003
 @@ -183,7 +183,7 @@ void KMainWindow::initKMainWindow(const 
          s = objname + '1'; // start adding number immediately
          unusedNumber = 1;
          }
 -    else if( name[ strlen( name ) - 1 ] == '#' )
 +    else if( strlen( name ) > 0 && name[ strlen( name ) - 1 ] == '#' )
          { // trailing # - always add a number
          objname = name;
          s = objname + '1'; // start adding number immediately

`--------------- Forwarded message (end)





More information about the kde-core-devel mailing list