fix: initialize complete backup checksum image

The RTC backup checksum covers every byte except the checksum itself, including a reserved packed byte that was never assigned. Its stack value could therefore make otherwise valid state fail verification after reset.

Zero-initialize the complete backup image before assigning persisted fields so the checksum and reserved byte are deterministic.
pull/165/head
PhysicistJohn 7 days ago
parent c97938697b
commit ead2a0a7a3

@ -161,7 +161,8 @@ static THD_FUNCTION(Thread1, arg)
while (1) {
// START_PROFILE
if (sweep_mode&(SWEEP_ENABLE|SWEEP_ONCE)) {
backup_t b;
/* Initialize the reserved byte covered by the checksum too. */
backup_t b = {0};
b.data.frequency0 = setting.frequency0;
b.data.frequency1 = setting.frequency1;
if (setting.auto_attenuation)

Loading…
Cancel
Save

Powered by TurnKey Linux.