mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-29 16:28:11 +00:00
fix: three bugs found in code review
- DataStore: validate ringtone2_len <= 32 after loading from flash (same guard as ringtone_len on line 252; we introduced this field but forgot the validation) - UITask: fix shutdown buzzer timeout to conventional unsigned form (millis() - start) < timeout to avoid unsigned underflow if called within first 2.5s of boot - UITask: guard _last_notif_ch_idx < 64 before 1ULL shift in notify() (defensive; MAX_GROUP_CHANNELS=40 so currently unreachable, but prevents UB if the value is ever unexpectedly out of range) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -273,6 +273,7 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
|
||||
if (file.available()) {
|
||||
file.read((uint8_t *)&_prefs.ringtone2_bpm_idx, sizeof(_prefs.ringtone2_bpm_idx));
|
||||
file.read((uint8_t *)&_prefs.ringtone2_len, sizeof(_prefs.ringtone2_len));
|
||||
if (_prefs.ringtone2_len > 32) _prefs.ringtone2_len = 0;
|
||||
file.read((uint8_t *)_prefs.ringtone2_notes, sizeof(_prefs.ringtone2_notes));
|
||||
if (file.available()) {
|
||||
file.read((uint8_t *)&_prefs.notif_melody_dm, sizeof(_prefs.notif_melody_dm));
|
||||
|
||||
Reference in New Issue
Block a user