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