fix(companion): pack and history files from the card checked, contact loops skip the reserved slots, small UI fixes

- L2 vector packs: a damaged count can't wrap the index size, and an
  entry pointing past the file is refused.
- L2 map share-target list: sized for 40 long channel names and 16
  favourites (it could overflow), off the stack.
- L2 SD history: a file with an unreadable header is set aside as .bad
  instead of written over; Delete message history takes those too.
- Contact lookups by key or hash start after the reserved anon slots (an
  empty one matched a 00 hop hash with a blank name); MessagesScreen uses
  contactctl::hopName().
- Nearby keeps its selection by public key: deleting a contact shifts
  the table.
- ui-new Live Share target cycle holds every channel and favourite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-12 18:31:35 +02:00
co-authored by Claude Opus 5.5
parent 4eee794a17
commit 57db27512d
10 changed files with 51 additions and 41 deletions
+4 -1
View File
@@ -993,7 +993,10 @@ void UITask::navToolsPopup() {
_nav_share_lbl = noteLabel(list, "", THEME_FONT_SMALL, theme::TEXT);
// Target: channels (as named -- "#" marks a hashtag channel), then
// favourite contacts (starred, so the two stay apart).
char opts[MAX_GROUP_CHANNELS * 24 + 16 * 40];
// Worst case: "\n" + a 31-byte name per channel, "\n" + star (3) + space +
// 31 bytes per favourite. Static: ~1.9 KB is a lot for the loop's stack, and
// the dropdown copies it.
static char opts[MAX_GROUP_CHANNELS * 32 + 16 * 36 + 1];
int o = 0, sel = 0;
navmap::s_share_n = 0;
for (int i = 0; i < MAX_GROUP_CHANNELS && navmap::s_share_n < navmap::SHARE_TARGETS; i++) {