Pulse: adjust buffer to maximum

Just in case, adjust the buffer to format an int32 to a string as the maximum
length that it could be.

Change-Id: I00aede3f684211f9c860455063244422be1d0ee9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6649
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Niels Sascha Reedijk
2023-06-28 07:11:17 +00:00
committed by Adrien Destugues
parent b9a6a85bc3
commit a962cc5543
+3 -3
View File
@@ -309,9 +309,9 @@ ConfigView::UpdateDeskbarIconWidth()
int width = atoi(fIconWidthControl->Text());
int min_width = GetMinimumViewWidth();
if (width < min_width || width > 50) {
char temp[10];
char temp[12];
if (width < min_width) {
sprintf(temp, "%d", min_width);
snprintf(temp, 12, "%d", min_width);
width = min_width;
} else {
strcpy(temp, "50");
@@ -368,7 +368,7 @@ ConfigView::_ResetDefaults()
fTarget.SendMessage(message);
char temp[10];
sprintf(temp, "%d", DEFAULT_DESKBAR_ICON_WIDTH);
snprintf(temp, 10, "%d", DEFAULT_DESKBAR_ICON_WIDTH);
fIconWidthControl->SetText(temp);
// Need to force the model message to be sent
fIconWidthControl->Invoke();