Browse Source

Fix buffer overflow in GuiTreeViewCtrl class.

When calculating test length (in method `GuiTreeViewCtrl::Item::getDisplayTextLength()`)
the code doesn't take into account the `ItemState::Marked`, which
adds additional char in `GuiTreeViewCtrl::Item::getDisplayText()` method.

This commit fixes warning printed into console when calling `dSprintf()`
as the buffer is now enough to fit all data.
bank 2 years ago
parent
commit
93cea86312
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Engine/source/gui/controls/guiTreeViewCtrl.cpp

+ 4 - 0
Engine/source/gui/controls/guiTreeViewCtrl.cpp

@@ -466,6 +466,10 @@ U32 GuiTreeViewCtrl::Item::getDisplayTextLength()
          if( internalName && internalName[ 0 ] )
             len += dStrlen( internalName ) + 3; // ' [<internalname>]'
       }
+      if( mState.test( Marked ) )
+      {
+         len += 1; // '*<name>'
+      }
 
       return len;
    }