From 3accaf358d5d7036ce1bfeee02ec695b1161723d Mon Sep 17 00:00:00 2001 From: Mark Rose Date: Fri, 27 Nov 2026 00:23:50 -0600 Subject: [PATCH] Bound the contact name copy into the UI recent list addToRecents() in the new and tiny companion UIs strcpy()s the contact name into a 32-byte field. Names are terminated on receipt now, but use a bounded copy here as well, like the other name copies in the UIs. Co-Authored-By: Claude Opus 5.5 --- src/helpers/ui/companion-new/UITask.cpp | 2 +- src/helpers/ui/companion-tiny/UITask.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/ui/companion-new/UITask.cpp b/src/helpers/ui/companion-new/UITask.cpp index 2427347a..532b0a2f 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 a26c50e0..612941a3 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(); }