Skip to content

To Fix Issue #590 - Update ota.cc #594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion main/ota.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,16 @@ bool Ota::CheckVersion() {
if (item->type == cJSON_String) {
settings.SetString(item->string, item->valuestring);
} else if (item->type == cJSON_Number) {
settings.SetInt(item->string, item->valueint);
// Guard against null key or problematic recursion; log for debug
if (item->string != nullptr) {
ESP_LOGI(TAG, "Setting websocket int key: %s = %d", item->string, item->valueint);
// Prevent possible recursion or known problematic fields
// You may add a whitelist here if needed, e.g.:
// if (strcmp(item->string, "some_safe_int_key") == 0)
settings.SetInt(item->string, item->valueint);
} else {
ESP_LOGW(TAG, "Null key in websocket int config, skipping");
}
}
}
has_websocket_config_ = true;
Expand Down