From 74cf69bb6716657575f52e0e207ff123c6e01575 Mon Sep 17 00:00:00 2001 From: Dāvis Mošenkovs Date: Tue, 4 Nov 2025 10:22:44 +0200 Subject: ImmediateAlertService: fix latent bug (#2159) Include null terminator in the bytes copied. Set notif.size as it is done in AlertNotificationService.cpp and AlertNotificationClient.cpp. --- src/components/ble/ImmediateAlertService.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/components/ble/ImmediateAlertService.cpp') diff --git a/src/components/ble/ImmediateAlertService.cpp b/src/components/ble/ImmediateAlertService.cpp index b9de615a..e25e018f 100644 --- a/src/components/ble/ImmediateAlertService.cpp +++ b/src/components/ble/ImmediateAlertService.cpp @@ -63,7 +63,8 @@ int ImmediateAlertService::OnAlertLevelChanged(uint16_t attributeHandle, ble_gat auto* alertString = ToString(alertLevel); NotificationManager::Notification notif; - std::memcpy(notif.message.data(), alertString, strlen(alertString)); + std::memcpy(notif.message.data(), alertString, strlen(alertString) + 1); + notif.size = strlen(alertString) + 1; notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert; notificationManager.Push(std::move(notif)); -- cgit v1.2.3-70-g09d2