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 <noreply@anthropic.com>
This commit is contained in:
1 parent
e86ed1373b
commit
3accaf358d
2 files changed
+2
-2
No files matched your search
@@ -264,7 +264,7 @@ public:
|
|||||||
auto p = &recent[recent_next_idx];
|
auto p = &recent[recent_next_idx];
|
||||||
recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE;
|
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();
|
p->recv_timestamp = _rtc->getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
auto p = &recent[recent_next_idx];
|
auto p = &recent[recent_next_idx];
|
||||||
recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE;
|
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();
|
p->recv_timestamp = _rtc->getCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user