From a962cc5543410400c47c5ab3c328d62f3c065d50 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 24 Jun 2023 21:26:19 +0100 Subject: [PATCH] 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 --- src/apps/pulse/ConfigView.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/pulse/ConfigView.cpp b/src/apps/pulse/ConfigView.cpp index b6c2de2ccc..7944f0eb88 100644 --- a/src/apps/pulse/ConfigView.cpp +++ b/src/apps/pulse/ConfigView.cpp @@ -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();