Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions serial/commands_backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ void cmd_import_keys(int argc, char **argv) {
return;
}

// Backup first
printf("backing up current keys...\r\n");
cmd_export_keys(0, NULL);

// M15: the safety-backup is emitted ONCE, later — only after the pasted blob
// has been received and base64-decoded (see "backing up current keys" below).
// The old unconditional backup here ran even when the import turned out to be
// empty/garbage, so it was removed.
printf("paste import data, then send empty line:\r\n");

// Read base64 directly from serial into a large static buffer
Expand Down
10 changes: 6 additions & 4 deletions serial/commands_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ void cmd_status(int argc, char **argv) {
printf("ntp: not synced\r\n");
}

// Keys (admin only: key inventory is target-selection data)
// Keys (admin only: key inventory is target-selection data). Declared at
// function scope so the scrub below always runs, even on the non-admin path
// where the array stays zero-initialised.
static key_record_t keys[BACKUP_MAX_KEYS];
if (commands_is_admin()) {
static key_record_t keys[BACKUP_MAX_KEYS];
int count = storage_key_list(keys, BACKUP_MAX_KEYS);
int enabled = 0, corrupt = 0;
int count = storage_key_list(keys, BACKUP_MAX_KEYS);
int enabled = 0, corrupt = 0;
for (int i = 0; i < count; i++) {
if (!keys[i].is_checksum_valid)
corrupt++;
Expand Down
Loading