Author: siarzhuk Date: 2011-02-27 00:10:20 +0100 (Sun, 27 Feb 2011) New Revision: 40708 Changeset: http://dev.haiku-os.org/changeset/40708 Modified: haiku/trunk/src/apps/processcontroller/PriorityMenu.cpp Log: Fix the crash during priority menu building - use the snprintf instead of sprintf. The buffer 32 + 20 bytes become too small for localized strings - increase it too. Modified: haiku/trunk/src/apps/processcontroller/PriorityMenu.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/PriorityMenu.cpp 2011-02-26 22:32:38 UTC (rev 40707) +++ haiku/trunk/src/apps/processcontroller/PriorityMenu.cpp 2011-02-26 23:10:20 UTC (rev 40708) @@ -76,7 +76,6 @@ { BMenuItem* item; BMessage* message; - char name[B_OS_NAME_LENGTH + 20]; long found = false; for (long index = 0; ; index++) { @@ -91,12 +90,16 @@ message = new BMessage('PrTh'); message->AddInt32("thread", fThreadID); message->AddInt32("priority", priority->priority); - sprintf(name, B_TRANSLATE("%s [%d]"), priority->name, - (int)priority->priority); - item = new BMenuItem(name, message); + BString name; + const size_t size = B_OS_NAME_LENGTH * 4; + snprintf(name.LockBuffer(size), size, + B_TRANSLATE("%s [%d]"), priority->name, (int)priority->priority); + name.UnlockBuffer(); + item = new BMenuItem(name.String(), message); item->SetTarget(gPCView); if (fPriority == priority->priority) found = true, item->SetMarked(true); AddItem(item); } } +