aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDāvis Mošenkovs <davikovs@gmail.com>2025-11-04 10:22:44 +0200
committerGitHub <noreply@github.com>2025-11-04 09:22:44 +0100
commit74cf69bb6716657575f52e0e207ff123c6e01575 (patch)
treedce2f9105156462b1d974462048d709185edb503 /src
parentc9a9e72c136234b3de0b8a50956ffe999025ed0d (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/components/ble/ImmediateAlertService.cpp3
1 files changed, 2 insertions, 1 deletions
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));