diff --git a/src/helpers/ui/companion-new/UITask.cpp b/src/helpers/ui/companion-new/UITask.cpp index 2427347af..532b0a2f6 100644 --- a/src/helpers/ui/companion-new/UITask.cpp +++ b/src/helpers/ui/companion-new/UITask.cpp @@ -264,7 +264,7 @@ public: auto p = &recent[recent_next_idx]; recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE; - strcpy(p->name, contact.name); + StrHelper::strncpy(p->name, contact.name, sizeof(p->name)); p->recv_timestamp = _rtc->getCurrentTime(); } diff --git a/src/helpers/ui/companion-tiny/UITask.cpp b/src/helpers/ui/companion-tiny/UITask.cpp index a26c50e0e..612941a32 100644 --- a/src/helpers/ui/companion-tiny/UITask.cpp +++ b/src/helpers/ui/companion-tiny/UITask.cpp @@ -159,7 +159,7 @@ public: auto p = &recent[recent_next_idx]; recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE; - strcpy(p->name, contact.name); + StrHelper::strncpy(p->name, contact.name, sizeof(p->name)); p->recv_timestamp = _rtc->getCurrentTime(); }