mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-08 17:52:44 +02:00
fix bug where channels imported from older config files displayed gibberish in channel scope under settingsscreen even when region scope not set; fix bug where after device clock sync advert times last heard weren't displaying correctly (ie showed 16895h)
This commit is contained in:
@@ -636,6 +636,17 @@ void DataStore::loadChannels(DataStoreHost* host) {
|
||||
|
||||
if (!success) break; // EOF
|
||||
|
||||
// Sanitize scope_name — reject if it contains non-region characters
|
||||
// (catches garbage from uninitialised memory in early channels3 files)
|
||||
ch.scope_name[30] = '\0'; // force null-terminate
|
||||
for (int s = 0; ch.scope_name[s]; s++) {
|
||||
char sc = ch.scope_name[s];
|
||||
if (!((sc >= 'a' && sc <= 'z') || (sc >= '0' && sc <= '9') || sc == '-')) {
|
||||
memset(ch.scope_name, 0, sizeof(ch.scope_name)); // invalid — clear
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (host->onChannelLoaded(channel_idx, ch)) {
|
||||
channel_idx++;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user