fix(companion): signing takes the buffer it can get (#38)

CMD_SIGN_START promised the app 8K before a malloc it never checked. On
the L1 the nRF52 heap has ~5K free from boot, so the malloc always failed
and every CMD_SIGN_DATA answered ERR_CODE_BAD_STATE. Now it allocates
first, halving down to 256 B, and reports the size it got; nothing at all
is an error on SIGN_START itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-28 23:34:29 +02:00
co-authored by Claude Opus 5.5
parent b355922d32
commit 0e1b3c9cfd
2 changed files with 18 additions and 8 deletions
+1
View File
@@ -633,6 +633,7 @@ private:
uint8_t app_target_ver;
uint8_t *sign_data;
uint32_t sign_data_len;
uint32_t sign_data_cap; // what the malloc got: at most MAX_SIGN_DATA_LEN
unsigned long dirty_contacts_expiry;
unsigned long _bot_last_ch_reply_ms;
unsigned long _bot_last_room_reply_ms;