浏览代码

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 年之前
父节点
当前提交
93cea86312
共有 1 个文件被更改,包括 4 次插入0 次删除
  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;
    }