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.
This commit is contained in:
bank 2023-04-24 13:41:19 +03:00
parent 6969531e2e
commit 93cea86312
No known key found for this signature in database
GPG key ID: 3CEA4264C6F57E51

View file

@ -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;
}