Skip to content

Commit f366956

Browse files
Claudeclaude
andcommitted
fix(cmd_status): function-scope keys so the coverage/firmware build compiles
Rebasing onto current master pulled in a latent build break: cmd_status declares `keys` inside the `if (commands_is_admin())` block but scrubs it via `secure_wipe(keys, sizeof(keys))` at function scope, so `keys` is undeclared there. asan_commands links serial/commands.c (not commands_system.c) so it never compiled this TU, but `make -C test coverage` compiles the whole first-party surface and fails here (`keys undeclared`) -- as does the real firmware build. Restore `keys` to function scope, matching the scrub's intent of always clearing the key DB from BSS (incl. the non-admin path where it stays zero-initialised). Same fix as PR hakierspejs#15 (M1). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c9d715a commit f366956

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

serial/commands_system.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ void cmd_status(int argc, char **argv) {
6464
printf("ntp: not synced\r\n");
6565
}
6666

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

0 commit comments

Comments
 (0)