Skip to content

Commit 74cf69b

Browse files
authored
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.
1 parent c9a9e72 commit 74cf69b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/ble/ImmediateAlertService.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ int ImmediateAlertService::OnAlertLevelChanged(uint16_t attributeHandle, ble_gat
6363
auto* alertString = ToString(alertLevel);
6464

6565
NotificationManager::Notification notif;
66-
std::memcpy(notif.message.data(), alertString, strlen(alertString));
66+
std::memcpy(notif.message.data(), alertString, strlen(alertString) + 1);
67+
notif.size = strlen(alertString) + 1;
6768
notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert;
6869
notificationManager.Push(std::move(notif));
6970

0 commit comments

Comments
 (0)