Fixed a possible buffer overflow (thanks Axel). Removed a todo item

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13236 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-06-23 13:22:58 +00:00
parent 755e899559
commit ba69a3795b

View File

@ -366,9 +366,7 @@ BMenuItem::DrawContent()
if (fBounds.Width() > labelWidth)
fSuper->DrawString(fLabel);
else {
// TODO: Ouch! Allocating the string every time
// isn't exactly cheap.
char *truncatedLabel = new char[strlen(fLabel) + 1];
char *truncatedLabel = new char[strlen(fLabel) + 4];
TruncateLabel(fBounds.Width(), truncatedLabel);
fSuper->DrawString(truncatedLabel);
delete[] truncatedLabel;